:root {
  color-scheme: light;

  /* Intelligence Platform colors (Zeroheight).
     This product (Resident Advisor / Brand & Market) uses purple as primary.
     Lime / aqua / blue are other product-line primaries — keep as secondary tokens. */
  --brand-black: #000000;
  --brand-white: #ffffff;
  /* Business Intelligence */
  --brand-lime: #cbe500;
  --brand-lime-dark: #7ba100;
  /* Optimization */
  --brand-blue: #43729a;
  --brand-aqua: #94ffef;
  /* Brand & Market — Primary 1 on Dark / on Light */
  --brand-purple: #a593ff;
  --brand-purple-dark: #514399;

  /* Neutrals — warm off-white chrome */
  --bg: #f4f2ef;
  /* Workspace canvas: barely off-white, with a graph-paper grid applied below. */
  --workspace: #fbfaf8;
  --workspace-grid: rgba(70, 64, 56, 0.022);
  --panel: var(--brand-white);
  --surface: #faf8f5;
  --border: #e4e0d8;
  --border-strong: #b8b2a8;
  --text: var(--brand-black);
  --muted: #5c574e;
  --muted-2: #8a8478;

  /* Accents: Brand & Market purple on light UI */
  --accent: var(--brand-purple);
  --accent-soft: rgba(165, 147, 255, 0.14);
  --accent-border: rgba(165, 147, 255, 0.42);
  --link: var(--brand-purple-dark);

  /* Success → lime; Error / warn → brand tints */
  --ok: var(--brand-black);
  --ok-soft: rgba(203, 229, 0, 0.28);
  --ok-border: rgba(123, 161, 0, 0.55);
  --err: var(--brand-black);
  --err-soft: rgba(165, 147, 255, 0.1);
  --err-border: rgba(81, 67, 153, 0.45);
  --warn: var(--brand-purple-dark);
  --warn-soft: rgba(81, 67, 153, 0.11);

  --radius: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.08);

  /* Typography scale */
  --font-display: 1.75rem;
  --font-header: 1.25rem;
  --font-body: 0.9375rem;
  --font-caption: 0.8125rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  /* Brand type: Helvetica Now when available; system Helvetica otherwise. */
  font-family: "Helvetica Now", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: var(--font-body);
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px 56px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100%;
}

.app--narrow {
  max-width: 440px;
}

/* ---------- Top bar ---------- */

.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.appbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

.appbar__email {
  font-size: 12px;
  color: var(--muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.appbar__mark {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  line-height: 0;
  color: var(--text);
  transform: rotate(-4deg);
  transform-origin: center center;
}

.appbar__logo-svg {
  display: block;
  height: 28px;
  width: auto;
}

.appbar__title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.appbar__sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.ghost-btn:hover {
  color: var(--text);
  border-color: var(--text);
}

.ghost-btn[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.ghost-btn--sm {
  font-size: 11px;
  padding: 4px 10px;
}

/* ---------- Layout / cards ---------- */

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.card__title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ---------- Form ---------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field[hidden] {
  display: none !important;
}

.field__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.field__hint {
  font-size: 11px;
  color: var(--muted);
}

.field__input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field__input--compact {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

textarea.field__input--compact {
  min-height: 72px;
}

/* Single-line variant: normal (non-monospace) font, no min-height so the
   control stays one line tall even with the compact spacing utilities. */
.field__input--line {
  font-size: 13px;
  padding: 8px 10px;
}

textarea.field__input {
  min-height: 88px;
}

/* ---------- Choice row ---------- */

.choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 640px) {
  .choice-row {
    grid-template-columns: 1fr;
  }
}

.choice {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.choice__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.choice__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.choice__label-row .choice__label {
  flex: 1;
  min-width: 0;
}

.choice__info {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-2, var(--muted));
  cursor: help;
  transition: color 0.15s, background 0.15s;
}

.choice__info:hover {
  color: var(--text);
  background: var(--surface-2, rgba(15, 23, 42, 0.06));
}

.choice__info:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.choice__select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

select.choice__select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

.choice__select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

@media (hover: hover) and (pointer: fine) {
  .choice__info[data-tooltip] {
    position: relative;
    z-index: 0;
  }

  .choice__info[data-tooltip]:hover,
  .choice__info[data-tooltip]:focus-visible {
    z-index: 3;
  }

  .choice__info[data-tooltip]:hover::after,
  .choice__info[data-tooltip]:focus-visible::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    left: auto;
    width: max-content;
    max-width: min(18rem, calc(100vw - 2rem));
    padding: 7px 9px;
    border-radius: var(--radius-sm);
    background: var(--panel);
    border: 1px solid var(--border-strong);
    color: var(--text);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: 0.01em;
    text-transform: none;
    text-align: left;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
    pointer-events: none;
    white-space: normal;
  }
}

/* ---------- Advanced disclosure ---------- */

.advanced {
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}

.advanced__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}

.advanced__toggle::-webkit-details-marker {
  display: none;
}

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

.advanced__caret {
  transition: transform 0.15s ease;
  font-size: 10px;
  color: var(--muted-2);
}

details[open] > summary .advanced__caret {
  transform: rotate(180deg);
}

.advanced__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

@media (max-width: 640px) {
  .advanced__grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Primary button ---------- */

.form__footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: var(--text);
  color: var(--brand-white);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}

/* Explicit display on .primary-btn overrides the UA [hidden] rule. */
.primary-btn[hidden],
.ghost-btn[hidden],
.sidebar-new-btn[hidden],
.sidebar-text-btn[hidden] {
  display: none !important;
}

.primary-btn:hover {
  background: var(--brand-purple-dark);
}

.primary-btn:active {
  transform: translateY(1px);
}

.primary-btn__arrow {
  transition: transform 0.15s ease;
}

.primary-btn:hover .primary-btn__arrow {
  transform: translateX(2px);
}

/* ---------- Progress card (status + site rows) ---------- */

.card--progress {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.progress__status {
  font-size: 13px;
  color: var(--text);
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress__status::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--accent-border);
  border-top-color: var(--accent);
  animation: spin 0.85s linear infinite;
  flex-shrink: 0;
}

.progress__status[data-final="done"]::before {
  border: 2px solid var(--brand-lime);
  border-top-color: var(--brand-lime);
  animation: none;
}

.progress__status[data-final="error"]::before {
  border: 2px solid var(--accent);
  border-top-color: var(--accent);
  animation: none;
}

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

/* ---------- Per-URL site chips ---------- */

.sites {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  font-size: 12px;
  min-width: 0;
}

.site__icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted-2);
  font-size: 11px;
}

.site[data-state="working"] .site__icon {
  color: var(--accent);
  background: var(--accent-soft);
  position: relative;
}

.site[data-state="working"] .site__icon::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-border);
  border-top-color: var(--accent);
  animation: spin 0.85s linear infinite;
}

.site[data-state="ok"] .site__icon {
  background: var(--ok-soft);
  color: var(--brand-black);
}

.site[data-state="error"] .site__icon {
  background: var(--err-soft);
  color: var(--err);
}

.site[data-state="warn"] .site__icon {
  background: var(--warn-soft);
  color: var(--warn);
}

.site__url {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.site--source .site__url {
  font-family: inherit;
  font-weight: 500;
  color: var(--muted);
}

.site__detail {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.site__error {
  flex-basis: 100%;
  color: var(--err);
  font-size: 11px;
  padding-left: 28px;
  margin-top: 2px;
}

/* ---------- Answer card ---------- */

.card--answer {
  box-shadow: var(--shadow-lg);
}

.answer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.answer-head__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.answer {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.answer.answer--rich h1,
.answer.answer--rich h2,
.answer.answer--rich h3,
.answer.answer--rich h4 {
  margin: 1.1em 0 0.4em;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.answer.answer--rich h1 {
  font-size: 1.3em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border);
}

.answer.answer--rich h2 {
  font-size: 1.15em;
}

.answer.answer--rich h3 {
  font-size: 1.02em;
  color: var(--link);
}

.answer.answer--rich p {
  margin: 0.6em 0;
}

.answer.answer--rich p:first-child {
  margin-top: 0;
}

.answer.answer--rich ul,
.answer.answer--rich ol {
  margin: 0.5em 0 0.7em;
  padding-left: 1.35em;
}

.answer.answer--rich li {
  margin: 0.25em 0;
}

.answer.answer--rich strong {
  font-weight: 700;
}

.answer.answer--rich blockquote {
  margin: 0.7em 0;
  padding: 0.35em 0 0.35em 0.9em;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--muted);
  border-radius: 0 6px 6px 0;
}

.answer.answer--rich code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.answer.answer--rich pre {
  margin: 0.7em 0;
  padding: 0.8em 1em;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: auto;
  font-size: 0.88em;
  line-height: 1.5;
}

.answer.answer--rich pre code {
  background: none;
  border: none;
  padding: 0;
}

.answer.answer--rich a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.answer.answer--rich table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.7em 0;
  font-size: 0.94em;
}

.answer.answer--rich th,
.answer.answer--rich td {
  border: 1px solid var(--border);
  padding: 0.45em 0.6em;
  text-align: left;
  vertical-align: top;
}

.answer.answer--rich th {
  background: var(--surface);
  font-weight: 600;
}

.answer pre.answer-json {
  margin: 0;
  padding: 0.85em 1em;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
}

/* ---------- Run details disclosure ---------- */

.run-details {
  margin-top: 18px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

.run-details__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}

.run-details__toggle::-webkit-details-marker {
  display: none;
}

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

.run-details__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
}

.run-details__section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.run-details__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.strategy {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 11px;
}

.strategy__kv {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.strategy__notes {
  flex-basis: 100%;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  color: var(--muted);
  font-size: 11px;
  white-space: pre-wrap;
}

/* ---------- Login ---------- */

.login-page {
  min-height: 100%;
  background:
    radial-gradient(
      1200px 600px at 12% -10%,
      rgba(203, 229, 0, 0.18),
      transparent 55%
    ),
    radial-gradient(
      900px 500px at 95% 0%,
      rgba(148, 255, 239, 0.22),
      transparent 50%
    ),
    linear-gradient(180deg, #f7f5f1 0%, var(--bg) 45%, #ebe8e2 100%);
}

.login-shell {
  width: min(720px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 100%;
  padding: 56px 0 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.login-brand__name {
  font-size: clamp(1.85rem, 4.5vw, 2.35rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}

.login-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 22px 20px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.login-blurb {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}

.login-contact {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.login-contact a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-contact a:hover {
  color: var(--brand-purple-dark);
}

.card--login {
  padding: 22px 24px;
}

.login-lead {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--err-border);
  background: var(--err-soft);
  color: var(--err);
  font-size: 13px;
}

.demo-gate-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.demo-gate-form__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.demo-gate-form__input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}

.demo-gate-form__input:focus {
  outline: 2px solid color-mix(in srgb, var(--brand-purple) 45%, transparent);
  outline-offset: 1px;
}

.demo-gate-form__submit {
  margin-top: 4px;
  width: 100%;
  justify-content: center;
}

.login-actions {
  display: flex;
  justify-content: stretch;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.google-btn:hover {
  border-color: var(--text);
  background: var(--surface);
}

.google-btn__icon {
  display: inline-flex;
  flex-shrink: 0;
}

.debug {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ===================================================================== */
/*  Chat-shell layout (three-column: history | chat | advisory)          */
/* ===================================================================== */

body.chat-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

.chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.demo-banner {
  flex-shrink: 0;
  padding: 8px 16px;
  background: #1a365d;
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.demo-quota-dialog__body {
  margin: 0 0 4px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}

.chat-topbar__left,
.chat-topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  appearance: none;
  border: none;
  background: transparent;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.chat-topbar__brand:hover {
  background: rgba(0, 0, 0, 0.04);
}

.chat-topbar__brand:focus-visible {
  outline: 2px solid var(--accent, #a593ff);
  outline-offset: 2px;
}

.chat-topbar__title {
  color: var(--brand-purple-dark);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.chat-topbar__sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.chat-topbar__email {
  font-size: 12px;
  color: var(--muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--text);
}

.icon-btn--ghost {
  border-color: transparent;
  background: transparent;
}

.icon-btn--ghost:hover {
  background: var(--surface);
}

.icon-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.icon-btn__chevron {
  display: inline-block;
  font-size: 20px;
  line-height: 1;
  font-weight: 600;
  transform: translateY(-1px);
}

/* Three-column grid ----------------------------------------------------- */

.chat-layout {
  flex: 1;
  display: grid;
  --left-sidebar-width: 280px;
  grid-template-columns: var(--left-sidebar-width) minmax(0, 1fr) 340px;
  min-height: 0;
}

/* Pin columns so hidden sidebars (display:none) do not re-flow main into a 0px track. */
.chat-layout > .chat-sidebar--left {
  grid-column: 1;
  grid-row: 1;
}

.chat-layout > .chat-main {
  grid-column: 2;
  grid-row: 1;
}

.chat-layout > .chat-sidebar--right {
  grid-column: 3;
  grid-row: 1;
}

.chat-layout[data-left-collapsed="true"] {
  grid-template-columns: 0 minmax(0, 1fr) 340px;
}

.chat-layout[data-right-collapsed="true"] {
  grid-template-columns: var(--left-sidebar-width) minmax(0, 1fr) 0;
}

.chat-layout[data-left-collapsed="true"][data-right-collapsed="true"] {
  grid-template-columns: 0 minmax(0, 1fr) 0;
}

@media (max-width: 1100px) {
  .chat-layout {
    grid-template-columns: var(--left-sidebar-width) minmax(0, 1fr) 300px;
  }
  .chat-layout[data-left-collapsed="true"] {
    grid-template-columns: 0 minmax(0, 1fr) 300px;
  }
  .chat-layout[data-right-collapsed="true"] {
    grid-template-columns: var(--left-sidebar-width) minmax(0, 1fr) 0;
  }
}

@media (max-width: 820px) {
  .chat-layout,
  .chat-layout[data-left-collapsed="true"],
  .chat-layout[data-right-collapsed="true"] {
    grid-template-columns: minmax(0, 1fr);
  }
  .chat-layout > .chat-sidebar--left,
  .chat-layout > .chat-main,
  .chat-layout > .chat-sidebar--right {
    grid-column: 1;
    grid-row: auto;
  }
  .chat-sidebar {
    position: fixed;
    top: 56px;
    bottom: 0;
    width: min(320px, 90vw);
    z-index: 20;
    transform: translateX(-105%);
  }
  .chat-sidebar--right {
    right: 0;
    transform: translateX(105%);
  }
  /* On mobile, overlays use transform — don't hard-hide via collapsed. */
  .chat-layout[data-left-collapsed="true"] .chat-sidebar--left,
  .chat-layout[data-right-collapsed="true"] .chat-sidebar--right {
    display: flex;
  }
  .chat-layout[data-left-open="true"] .chat-sidebar--left {
    transform: translateX(0);
  }
  .chat-layout[data-right-open="true"] .chat-sidebar--right {
    transform: translateX(0);
  }
}

/* Sidebars -------------------------------------------------------------- */

.chat-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 12px 10px 20px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: transform 0.2s ease;
  min-height: 0;
  min-width: 0;
}

.chat-sidebar--left {
  /* Single scroll container — lists inside must not nest overflow. */
  position: relative;
  gap: 16px;
  background: color-mix(in srgb, var(--bg) 55%, var(--panel));
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  overflow-x: hidden;
}

.chat-sidebar__resize {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  z-index: 5;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}

.chat-sidebar__resize::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 2px;
  border-radius: 1px;
  background: transparent;
  transition: background 120ms ease;
}

.chat-sidebar__resize:hover::after,
.chat-sidebar__resize:focus-visible::after,
.chat-layout[data-left-resizing="true"] .chat-sidebar__resize::after {
  background: var(--accent, #a593ff);
}

.chat-sidebar__resize:focus-visible {
  outline: none;
}

.chat-layout[data-left-resizing="true"] {
  cursor: col-resize;
  user-select: none;
}

.chat-layout[data-left-resizing="true"] .chat-main,
.chat-layout[data-left-resizing="true"] .chat-sidebar--right {
  pointer-events: none;
}

@media (max-width: 820px) {
  .chat-sidebar__resize {
    display: none;
  }
}

.chat-sidebar--right {
  border-right: none;
  border-left: 1px solid var(--border);
}

.chat-layout[data-left-collapsed="true"] .chat-sidebar--left,
.chat-layout[data-right-collapsed="true"] .chat-sidebar--right {
  display: none;
}

.chat-sidebar__top {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 2px 0 2px;
  background: color-mix(in srgb, var(--bg) 55%, var(--panel));
}

.sidebar-top-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.sidebar-search-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sidebar-search-btn:hover,
.sidebar-search-btn[aria-pressed="true"] {
  background: color-mix(in srgb, var(--brand-black) 8%, var(--panel));
  border-color: color-mix(in srgb, var(--brand-black) 28%, var(--border));
  color: var(--brand-black);
}

.sidebar-search-btn i {
  font-size: 14px;
}

.sidebar-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: var(--brand-black);
  color: var(--brand-white);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.08s ease;
}

.sidebar-new-btn--compact {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  gap: 6px;
  padding: 9px 10px;
  font-size: 12px;
}

.sidebar-new-btn:hover {
  background: var(--brand-purple-dark);
}

.sidebar-new-btn:active {
  transform: translateY(1px);
}

.sidebar-new-btn__icon {
  font-size: 16px;
  line-height: 1;
  font-weight: 500;
}

.workspace-search {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 28px 24px 48px;
}

.workspace-search[hidden] {
  display: none !important;
}

.workspace-search__inner {
  width: min(720px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.workspace-search__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.workspace-search__icon {
  color: var(--muted);
  font-size: 15px;
}

.workspace-search__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 18px;
  line-height: 1.35;
  color: var(--text);
  outline: none;
}

.workspace-search__input::placeholder {
  color: var(--muted);
}

.workspace-search__status {
  margin: 0;
  min-height: 1.2em;
  font-size: 13px;
  color: var(--muted);
}

.workspace-search__results {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.workspace-search__section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.workspace-search__heading {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.workspace-search__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.workspace-search__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.workspace-search__item:hover,
.workspace-search__item:focus-visible {
  border-color: color-mix(in srgb, var(--brand-black) 30%, var(--border));
  background: color-mix(in srgb, var(--brand-black) 4%, var(--panel));
  outline: none;
}

.workspace-search__item-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
}

.workspace-search__item-meta,
.workspace-search__item-snippet {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.workspace-search__item-snippet {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.workspace-search__empty {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.sidebar-text-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
}

.sidebar-text-btn:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
}

.chat-sidebar__section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.chat-sidebar__section--personas {
  padding-top: 6px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}

.chat-sidebar__section--profile {
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}

.chat-sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 6px 2px;
  min-width: 0;
}

.chat-sidebar__head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.client-sort {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.client-sort__btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted-2);
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
}

.client-sort__btn:hover {
  color: var(--muted);
  background: rgba(0, 0, 0, 0.04);
}

.client-sort__btn[aria-pressed="true"] {
  color: var(--text);
  background: rgba(0, 0, 0, 0.06);
}

.chat-sidebar__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-sidebar__label--sub {
  letter-spacing: 0.04em;
}

.chat-sidebar__sub {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-sidebar__sub[hidden] {
  display: none;
}

/* History list — dense, no nested scroll -------------------------- */

.history-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.history-item {
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 7px 6px 7px 8px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  color: var(--text);
  transition: background 0.12s;
  position: relative;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.history-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.history-item[aria-current="true"] {
  background: var(--accent-soft);
}

.history-item__title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item__meta {
  font-size: 11px;
  color: var(--muted-2);
  flex-shrink: 0;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 8px;
  line-height: 1.4;
}

.history-show-all,
.sidebar-show-all {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted-2);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  padding: 6px 8px;
  margin-top: 2px;
  border-radius: 6px;
  cursor: pointer;
}

.history-show-all:hover,
.sidebar-show-all:hover {
  color: var(--muted);
  background: rgba(0, 0, 0, 0.03);
}

/* Personas — list rows, not cards -------------------------------- */

.chat-sidebar__count {
  font-weight: 500;
  color: var(--muted-2);
  font-size: 11px;
  margin-left: 4px;
  text-transform: none;
  letter-spacing: 0;
}

.chat-sidebar__help {
  font-size: 11px;
  color: var(--muted-2);
  margin: 2px 0 8px;
  line-height: 1.4;
}

.persona-list,
.client-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.persona-list__empty,
.client-list__empty,
.client-list__loading {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 8px;
  line-height: 1.4;
}

.client-list__loading,
.home-card-grid__loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brands-loading__gif {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent, #a593ff);
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

.persona-item,
.client-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 7px 6px 7px 8px;
  background: transparent;
  cursor: pointer;
  transition: background 120ms ease;
  min-width: 0;
  width: 100%;
  text-align: left;
}

.persona-item:hover,
.client-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.persona-item[aria-selected="true"],
.persona-item[aria-current="true"],
.client-item[aria-current="true"] {
  background: var(--accent-soft);
}

.persona-item__body,
.client-item__body {
  min-width: 0;
  flex: 1 1 auto;
}

.persona-item__title,
.client-item__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.persona-item__desc,
.client-item__desc {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 1px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.persona-item__edit,
.client-item__edit {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted-2);
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 2px 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s, background 0.12s;
}

.persona-item:hover .persona-item__edit,
.persona-item:focus-within .persona-item__edit,
.client-item:hover .client-item__edit,
.client-item:focus-within .client-item__edit {
  opacity: 1;
}

.persona-item__edit:hover,
.client-item__edit:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.06);
}


.wizard-client-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.wizard-client-picker__select {
  width: 100%;
}

.wizard-client-picker__empty {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  width: 100%;
}

.wizard-client-picker__selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wizard-client-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px 8px 5px 10px;
  border: 1px solid var(--accent, #514399);
  border-radius: 8px;
  background: var(--accent-soft, rgba(81, 67, 153, 0.08));
  font-size: 12px;
  color: var(--text);
  user-select: none;
}

.wizard-client-chip__name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wizard-client-chip__host {
  color: var(--muted-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

.wizard-client-chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 2px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.wizard-client-chip__remove:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.06);
}

.ghost-btn--danger {
  color: #b14a55;
  border-color: #e2b5bb;
  margin-left: auto;
}

.ghost-btn--danger:hover {
  color: #fff;
  background: #b14a55;
  border-color: #b14a55;
}

.primary-btn--sm {
  font-size: 12px;
  padding: 6px 12px;
}

/* Advisory meta --------------------------------------------------------- */

.advisory-meta {
  font-size: 12px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.advisory-meta__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.advisory-meta__row {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 8px;
  align-items: baseline;
  margin: 0;
}

.advisory-meta__label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.5;
  margin: 0;
}

.advisory-meta__value {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.4;
  margin: 0;
  word-break: break-word;
}

.advisory-meta__quote {
  display: block;
  font-style: italic;
  color: var(--muted-2, var(--muted));
  padding-left: 8px;
  border-left: 2px solid var(--border-strong);
  line-height: 1.45;
}

.advisory-meta__links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.advisory-meta__link {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}

.advisory-meta__link:hover {
  text-decoration: underline;
}

.advisory-meta__divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0 2px;
}

.advisory-meta__actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-start;
}

/* Legacy class — kept for any in-flight markup; the new layout replaces it. */
.advisory-meta__urls {
  color: var(--text);
  word-break: break-all;
}

/* Center chat main ------------------------------------------------------ */

.chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  position: relative;
  /* Solid fill only. The grid lives on the scrolling pane so it moves
     with a brand, a conversation, or the workspace. */
  background-color: var(--workspace);
}

.chat-timeline,
.home-empty,
.client-view,
.persona-view,
.workspace-search {
  background-color: var(--workspace);
  background-image:
    linear-gradient(to right, var(--workspace-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--workspace-grid) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -1px -1px;
  background-attachment: local;
}

.chat-timeline {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 32px 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Author `display: flex` beats the UA [hidden] rule — hide explicitly. */
.chat-timeline[hidden] {
  display: none;
}

.chat-composer[hidden] {
  display: none;
}

/*
 * Flex scroll containers often ignore padding-bottom when computing
 * scrollHeight. A trailing spacer keeps the last turn (and Copy) above
 * the floating composer.
 */
.chat-timeline::after {
  content: "";
  flex: 0 0 auto;
  height: max(12rem, calc(10.5rem + env(safe-area-inset-bottom, 0px)));
  pointer-events: none;
}

.chat-empty {
  max-width: 560px;
  margin: 10vh auto 0;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.chat-empty__title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.chat-empty__body {
  font-size: 14px;
  margin: 0 0 12px;
  line-height: 1.55;
}

.chat-empty__hint {
  font-size: 12px;
  margin: 0;
  color: var(--muted-2);
}

/* Chat turns ------------------------------------------------------------ */

.chat-turn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 820px;
  align-self: stretch;
}

.chat-turn--user {
  align-self: flex-end;
  max-width: 640px;
}

.chat-turn__role {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.chat-turn--user .chat-turn__role {
  text-align: right;
}

.chat-bubble {
  border-radius: 16px;
  padding: 14px 16px;
  line-height: 1.55;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  overflow-wrap: anywhere;
}

.chat-turn--user .chat-bubble {
  background: var(--accent);
  color: var(--brand-white);
  border-bottom-right-radius: 6px;
}

.chat-turn--assistant .chat-bubble {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 6px;
}

.chat-bubble .answer--rich :first-child { margin-top: 0; }
.chat-bubble .answer--rich :last-child { margin-bottom: 0; }

.answer-attachments {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.answer-attachments__item {
  margin: 0;
}

.answer-attachments__frame {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.answer-attachments__img {
  display: block;
  width: 100%;
  max-width: 640px;
  height: auto;
  border-radius: 10px;
}

.answer-attachments__download {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  border-radius: 8px;
  background: var(--surface, rgba(255, 255, 255, 0.92));
  color: var(--muted, #666);
  cursor: pointer;
  opacity: 0.72;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.answer-attachments__frame:hover .answer-attachments__download,
.answer-attachments__download:hover,
.answer-attachments__download:focus-visible {
  opacity: 1;
  color: var(--text, #111);
  border-color: var(--border-strong, rgba(0, 0, 0, 0.2));
}

.answer-attachments__download-icon {
  width: 16px;
  height: 16px;
}

.answer-attachments__caption {
  padding: 8px 0 0;
  font-size: 0.8125rem;
  color: var(--muted, #666);
}

.code-block-wrap {
  position: relative;
  margin: 0.75em 0;
}

.code-block-wrap pre {
  margin: 0;
}

.code-block-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  border-radius: 8px;
  background: var(--surface, rgba(255, 255, 255, 0.92));
  color: var(--muted, #666);
  cursor: pointer;
}

.code-block-copy:hover {
  color: var(--text, #111);
  border-color: var(--border-strong, rgba(0, 0, 0, 0.2));
}

.code-block-copy.is-copied {
  color: var(--accent, #2563eb);
  border-color: var(--accent, #2563eb);
}

.code-block-copy__icon {
  width: 16px;
  height: 16px;
}

.answer-image-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.answer-image-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.answer-image-loading__spinner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--accent-border);
  border-top-color: var(--accent);
  animation: spin 0.85s linear infinite;
  flex-shrink: 0;
}

.chat-turn__actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.chat-turn--user .chat-turn__actions {
  justify-content: flex-end;
}

/* Composer -------------------------------------------------------------- */

.chat-composer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 6px 24px max(10px, env(safe-area-inset-bottom, 0px));
}

.chat-composer__inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-composer__form {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 6px 8px;
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.04),
    0 18px 44px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Brand overview ask has no tailor wrapper — keep the form centered. */
.chat-composer > .chat-composer__form {
  max-width: 860px;
  margin: 0 auto;
}

.chat-composer__row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-composer__input {
  flex: 1;
  min-height: 32px;
  max-height: 200px;
  border: none;
  resize: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  padding: 6px 4px;
  overflow-y: auto;
}

.chat-composer__urls {
  border-bottom: 1px dashed var(--border);
  padding-bottom: 8px;
}

.chat-composer__status {
  font-size: 11px;
  color: var(--muted);
  min-height: 14px;
  padding: 0 4px;
}

.chat-composer__status[data-state="error"] {
  color: #b14a55;
}

/* Progress / run details in the new shell ------------------------------- */

.chat-timeline .card--progress {
  margin: 0;
  max-width: 820px;
  align-self: stretch;
}

/* Centered advisory creation form --------------------------------------- */

.advisory-create {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 24px 48px;
  overflow-y: auto;
}

.advisory-create[hidden] {
  display: none;
}

.advisory-create__inner {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.advisory-create__header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.advisory-create__title {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

.advisory-create__subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

/* Right-sidebar empty state (shown before any advisory is created). */
.chat-sidebar__empty {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  padding: 8px 2px 0;
}

.advisory-technical {
  font-size: 11px;
  color: var(--text);
  line-height: 1.45;
  padding: 0 2px 10px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 10px;
}

.advisory-technical[hidden] {
  display: none !important;
}

.advisory-technical .advisory-meta__list {
  gap: 6px;
}

.advisory-technical .advisory-meta__label {
  font-size: 10px;
}

.advisory-technical .advisory-meta__value {
  font-size: 11px;
}

.advisory-technical__notes {
  margin: 8px 0 0;
  padding: 8px 0 0;
  border-top: 1px dashed var(--border);
  font-size: 10px;
  color: var(--muted-2);
  white-space: pre-wrap;
}

.advisory-source-pack {
  border-bottom: 1px dashed var(--border);
}

.advisory-source-pack__paths {
  margin: 6px 0 0;
  font-size: 10px;
  color: var(--muted-2);
  line-height: 1.4;
}

.chat-turn__sources {
  margin: 6px 0 0;
}

.chat-turn__sources--static {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  cursor: default;
  user-select: none;
  pointer-events: none;
}

.chat-turn__sources--static .chat-turn__sources-text {
  white-space: normal;
}

.chat-turn__sources-btn {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.chat-turn__sources-btn:hover .chat-turn__sources-more,
.chat-turn__sources-btn:focus-visible .chat-turn__sources-more {
  text-decoration: underline;
}

.chat-turn__sources-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-turn__sources-more {
  flex: 0 0 auto;
  color: var(--link);
  font-weight: 600;
}

.sources-dialog__score {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text);
}

.sources-dialog__score strong {
  font-size: 18px;
  font-weight: 700;
  margin-right: 6px;
}

.sources-dialog__score--high strong {
  color: var(--brand-lime-dark);
}

.sources-dialog__score--moderate strong {
  color: var(--brand-purple-dark);
}

.sources-dialog__score--limited strong,
.sources-dialog__score--low strong {
  color: var(--muted);
}

.sources-dialog__reasons {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.sources-dialog__files {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.sources-dialog__body {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sources-dialog__h {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.sources-dialog__blurb {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.sources-dialog__section--tech .sources-dialog__h:first-child {
  margin-bottom: 12px;
}

.sources-dialog__section--tech .sources-dialog__h:not(:first-child) {
  margin-top: 14px;
}

.advisory-meta__muted {
  color: var(--muted);
  font-style: normal;
}

.advisory-meta__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
  margin-bottom: 8px;
}

/* History item with kebab menu ------------------------------------------ */

.history-item__body {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-height: 0;
  overflow: hidden;
}

.history-item__title-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.history-item__kebab {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s, color 0.12s;
}

.history-item:hover .history-item__kebab,
.history-item__kebab[aria-expanded="true"],
.history-item:focus-within .history-item__kebab {
  opacity: 1;
}

.history-item__kebab:hover,
.history-item__kebab[aria-expanded="true"] {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

/* Rendered as a portal on <body> so the sidebar's overflow never clips it. */
.history-menu {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  padding: 4px;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.history-menu[hidden] {
  display: none;
}

.history-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
}

.history-menu__item:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.history-menu__item--danger {
  color: #b14a55;
}

.history-menu__item--danger:hover {
  background: rgba(177, 74, 85, 0.08);
}

/* ---------- Home dashboard --------------------------------------------- */

.home-empty {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 36px 28px 48px;
  overflow-y: auto;
}

.home-empty[hidden] {
  display: none;
}

.home-empty__inner,
.home-dashboard {
  width: 100%;
  max-width: 960px;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 28px;
}

.home-dashboard__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.home-dashboard__intro {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 240px;
}

.home-empty__title {
  margin: 0;
  font-size: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}

.home-empty__subtitle {
  margin: 0;
  font-size: var(--font-body);
  color: var(--muted);
  line-height: 1.55;
}

.home-card-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.home-card-row__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.home-card-row__copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.home-card-row__label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.home-card-row__desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
  max-width: 42em;
}

.home-card-row__head .primary-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.home-setup {
  padding-bottom: 36px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-strong);
}

.home-setup__panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px 16px;
}

.advisory-wizard--home {
  flex: 0 0 auto;
  overflow: visible;
}

.advisory-wizard--home .advisory-wizard__form {
  overflow: visible;
  flex: 0 0 auto;
  gap: 0;
}

.advisory-wizard--home .advisory-wizard__body {
  overflow: visible;
  padding: 0 0 12px;
}

.advisory-wizard--home .advisory-wizard__foot {
  padding-top: 12px;
}

.advisory-wizard--home .wizard-client-picker {
  margin-top: 0;
}

@media (min-width: 720px) {
  .advisory-wizard--home .wizard-step {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px 28px;
    align-items: start;
  }
}

@media (max-width: 520px) {
  .home-card-row__head {
    flex-direction: column;
    align-items: stretch;
  }

  .home-card-row__head .primary-btn {
    align-self: flex-start;
  }
}

.home-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 900px) {
  .home-card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .home-card-grid {
    grid-template-columns: 1fr;
  }
}

.home-card-grid__empty,
.home-card-grid__loading {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--muted);
  padding: 16px 4px;
  line-height: 1.45;
}

.home-card {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.home-card:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md, var(--shadow-sm));
}

.home-card__title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.home-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.home-card__meta {
  font-size: 12px;
  color: var(--muted-2);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---------- Client settings (full-page) -------------------------------- */

.client-view {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  overflow-y: auto;
  padding: 32px 28px 48px;
}

.client-view[hidden] {
  display: none;
}

/*
 * Flex scroll containers often ignore padding-bottom when computing
 * scrollHeight (same issue as .chat-timeline). Use a trailing spacer so
 * Advisories can scroll clear of the floating ask composer.
 */
.client-view.client-view--with-ask::after {
  content: "";
  display: block;
  flex: 0 0 auto;
  height: max(20rem, calc(18rem + env(safe-area-inset-bottom, 0px)));
  pointer-events: none;
}

.client-view__shell {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
}

.client-view__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.client-view__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
}

.client-overview__edit {
  flex: 0 0 auto;
  margin-left: auto;
}

.client-overview__edit[hidden] {
  display: none;
}

.client-overview[hidden],
.client-view__form.entity-dialog__form[hidden],
.client-view__form[hidden] {
  display: none;
}

.brand-shelves {
  margin: 36px 0 0;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.brand-discovery {
  margin: 28px 0 0;
  padding: 18px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2, rgba(0, 0, 0, 0.02));
}

.brand-discovery__title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 600;
}

.brand-discovery__hint {
  margin: 0 0 14px;
  font-size: 0.88rem;
  color: var(--muted, #6b7280);
}

.brand-discovery__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand-discovery__status {
  font-size: 0.92rem;
  line-height: 1.45;
}

.brand-discovery__status-label {
  font-weight: 600;
  text-transform: capitalize;
}

.brand-discovery__question {
  font-size: 0.88rem;
  color: var(--muted, #6b7280);
  font-style: italic;
}

.brand-discovery__human {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  color: var(--muted, #6b7280);
}

.brand-discovery__human li {
  margin: 0 0 4px;
}

.brand-discovery__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.brand-discovery__error {
  font-size: 0.85rem;
  color: var(--danger, #b91c1c);
}

.auto-gen-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  white-space: nowrap;
}

.chat-turn__auto-chip {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  vertical-align: middle;
}

.home-card__title-row,
.client-overview__advisory-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.brand-shelves__title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 600;
}

.brand-shelves__hint {
  margin: 0 0 14px;
  font-size: 0.88rem;
  color: var(--muted, #6b7280);
}

.brand-shelves__grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border);
}

.brand-shelf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 20px;
  width: 100%;
  text-align: left;
  padding: 12px 8px;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: background 120ms ease;
}

.brand-shelf:hover {
  background: rgba(0, 0, 0, 0.04);
}

.brand-shelf__main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 7.5rem;
}

.brand-shelf__name {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}

.brand-shelf__status {
  display: inline-flex;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.brand-shelf__status--filled {
  background: rgba(22, 163, 74, 0.15);
  color: #15803d;
}

.brand-shelf__status--partial {
  background: rgba(234, 179, 8, 0.18);
  color: #a16207;
}

.brand-shelf__status--empty {
  background: rgba(107, 114, 128, 0.14);
  color: #6b7280;
}

.brand-shelf__action {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted, #6b7280);
  text-align: right;
}

@media (max-width: 640px) {
  .brand-shelf {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .brand-shelf__action {
    text-align: left;
    padding-left: 0;
  }
}

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 760px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.settings-section__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}

.settings-section__hint {
  margin: -4px 0 0;
  color: var(--muted, #6f6a62);
  font-size: 13px;
  line-height: 1.45;
}

.settings-advanced {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.settings-advanced summary {
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 650;
}

.settings-inline__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.settings-inline__pencil,
.settings-inline__check {
  border: 0;
  background: transparent;
  color: var(--muted, #6f6a62);
  padding: 0 2px;
  line-height: 1;
  cursor: pointer;
}

.settings-inline__pencil {
  opacity: 0;
}

.settings-inline__pencil[hidden] {
  display: none;
}

.settings-inline__label:hover .settings-inline__pencil,
.settings-inline__label:focus-within .settings-inline__pencil,
.settings-inline__pencil:focus {
  opacity: 1;
}

.settings-inline__pencil:hover,
.settings-inline__check:hover {
  color: var(--text, #1c1915);
}

.settings-inline__editor {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.settings-inline__editor .field__input {
  flex: 1 1 auto;
  min-width: 0;
}

.settings-inline__stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.settings-inline__checklabel {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.settings-advanced__danger {
  padding-top: 4px;
}

.settings-advanced__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 14px 16px;
}

.client-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.client-links__row,
.client-links__add {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.client-links__add .field__input {
  flex: 1 1 180px;
  min-width: 0;
}

.client-links__name {
  font-weight: 650;
}

.client-links__meta,
.client-links__status {
  color: var(--muted, #6f6a62);
  font-size: 12px;
}

.client-links__relation {
  margin-left: auto;
}

.client-overview__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.9fr);
  gap: 28px 32px;
  align-items: start;
}

.client-overview__col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.client-overview__col--side {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  gap: 22px;
}

@media (max-width: 820px) {
  .client-overview__grid {
    grid-template-columns: 1fr;
  }
}

.client-overview__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.client-overview__value {
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}

.client-overview__value a {
  color: var(--brand-purple);
  text-decoration: none;
}

.client-overview__value a:hover {
  text-decoration: underline;
}

.client-overview__value--muted {
  color: var(--muted);
}

#clientOverviewVisibility {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

/* List rows push the icon right with margin-left:auto; overview should stay left. */
#clientOverviewVisibility .client-vis {
  margin-left: 0;
}

.client-overview__vis-label {
  font-size: 14px;
  color: var(--text);
}

.client-overview__advisories {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.client-overview__advisories-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
}

.client-overview__advisories-hint {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.client-overview__advisories-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.client-overview__advisories-empty {
  font-size: 13px;
  color: var(--muted);
  padding: 10px 0;
}

.client-overview__advisory {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 120ms ease;
}

.client-overview__advisory:hover {
  background: rgba(0, 0, 0, 0.04);
}

.client-overview__advisory-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-overview__advisory-meta {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted-2);
}

.client-view__form {
  width: 100%;
}

.client-view__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px 32px;
  align-items: start;
}

.client-view__col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.client-view__col--side {
  gap: 20px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 820px) {
  .client-view__grid {
    grid-template-columns: 1fr;
  }

  .client-view__col--side {
    padding: 16px;
  }
}

.client-view__note {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: var(--radius-sm, 8px);
  background: var(--accent-soft, rgba(0, 0, 0, 0.04));
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.client-view__actions {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.client-view .client-docs,
.client-view .client-social {
  margin: 0;
}

.client-view .client-docs__dropzone {
  min-height: 88px;
}

/* ---------- Persona create/edit (main pane) ---------------------------- */

.persona-view {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  overflow-y: auto;
  padding: 32px 28px 48px;
}

.persona-view[hidden] {
  display: none;
}

.persona-view__shell {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.persona-view__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.persona-view__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.persona-view__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.persona-view__actions {
  margin-top: 8px;
}

/* ---------- Advisory setup (home dashboard) ---------------------------- */

.advisory-wizard {
  width: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.advisory-wizard.home-setup__panel {
  background: var(--panel);
}

.advisory-wizard__form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.advisory-wizard__body {
  padding: 0;
}

.wizard-step__intro {
  margin: 0 0 14px;
  font-size: var(--font-caption);
  color: var(--muted);
  line-height: 1.5;
}

.wizard-step__error {
  margin: 8px 0 0;
  font-size: 12px;
  color: #b14a55;
}

.wizard-step__error[hidden] {
  display: none;
}

.url-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.url-list__row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.url-list__row .field__input {
  flex: 1 1 auto;
  min-width: 0;
}

.url-list__remove {
  flex-shrink: 0;
}

.url-list__add {
  align-self: flex-start;
  margin-top: 4px;
}

.advisory-wizard__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
  background: transparent;
}

.advisory-wizard__foot-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Pulse on right toggle after create */
.icon-btn--pulse {
  animation: icon-pulse 1.4s ease 2;
}

@keyframes icon-pulse {
  0%,
  100% {
    box-shadow: none;
  }
  50% {
    box-shadow: 0 0 0 4px var(--ok-soft);
  }
}

/* Composer tailor bar — sits above the bordered input box */
.composer-tailor {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 5px;
  border-radius: var(--radius-sm, 8px);
  background: transparent;
}

.composer-tailor__toggle {
  appearance: none;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin: 0;
  padding: 2px 4px;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
}

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

.composer-tailor__toggle:focus-visible {
  outline: 2px solid var(--accent-soft, color-mix(in srgb, var(--brand-purple) 35%, transparent));
  outline-offset: 1px;
}

.composer-tailor__toggle-label {
  letter-spacing: 0.02em;
}

.composer-tailor__toggle .fa {
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1;
  color: var(--muted);
}

.composer-tailor__toggle:hover .fa {
  color: var(--text);
}

.composer-tailor__summary {
  font-weight: 500;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.composer-tailor__summary[hidden] {
  display: none;
}

.composer-tailor__caret {
  font-size: 10px;
  color: var(--muted-2);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.composer-tailor[data-collapsed="true"] .composer-tailor__caret {
  transform: rotate(-90deg);
}

.composer-tailor__fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 10px;
}

.composer-tailor[data-collapsed="true"] .composer-tailor__fields {
  display: none;
}

.composer-tailor__field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 100px;
  max-width: 160px;
  position: relative;
}

.composer-tailor__label {
  appearance: none;
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted-2);
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, var(--muted-2) 55%, transparent);
}

.composer-tailor__label:hover,
.composer-tailor__label:focus-visible {
  color: var(--brand-purple, #5b4cdb);
  text-decoration-color: currentColor;
}

.composer-tailor__label:focus-visible {
  outline: 2px solid var(--accent-soft, color-mix(in srgb, var(--brand-purple) 35%, transparent));
  outline-offset: 2px;
  border-radius: 2px;
}

/* Native select is kept for value/sync; UI is the upward custom menu. */
.composer-tailor__select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.up-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.up-select__trigger {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background-color: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.up-select__trigger:hover {
  border-color: var(--border-strong, var(--accent-border));
}

.up-select__trigger:focus {
  outline: 2px solid var(--accent-soft, color-mix(in srgb, var(--brand-purple) 35%, transparent));
  outline-offset: 1px;
  border-color: var(--brand-purple);
}

.up-select.is-open .up-select__trigger {
  border-color: var(--brand-purple);
}

.up-select__value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.up-select__caret {
  flex-shrink: 0;
  font-size: 9px;
  color: var(--muted-2);
  transform: rotate(180deg);
}

.up-select__menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 4px);
  top: auto;
  z-index: 20;
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: min(240px, 40vh);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm, 6px);
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.12);
}

.up-select__menu[hidden] {
  display: none;
}

.up-select__option {
  display: block;
  width: 100%;
  margin: 0;
  padding: 6px 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.up-select__option:hover,
.up-select__option:focus {
  background: var(--accent-soft, color-mix(in srgb, var(--brand-purple) 18%, transparent));
  outline: none;
}

.up-select__option[aria-selected="true"] {
  font-weight: 600;
  background: color-mix(in srgb, var(--brand-purple) 12%, var(--panel));
}

@media (max-width: 520px) {
  .composer-tailor__field {
    flex: 1 1 calc(50% - 10px);
    max-width: none;
  }
}

/* Centered modal overlays (rename, client, persona) */
.entity-dialog {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.32);
}

.entity-dialog[hidden] {
  display: none;
}

.entity-dialog__panel {
  width: min(360px, 100%);
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.entity-dialog__panel--form {
  width: min(440px, 100%);
  max-height: min(88vh, 720px);
  overflow: auto;
}

.entity-dialog__panel.entity-dialog__panel--sources {
  width: min(760px, 100%);
  max-height: min(88vh, 860px);
}

.tailor-help__body {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: min(64vh, 640px);
  padding-right: 4px;
}

.tailor-help__lede {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.tailor-help__section {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.tailor-help__section.is-target {
  border-color: var(--brand-purple, #5b4cdb);
  background: color-mix(in srgb, var(--brand-purple, #5b4cdb) 8%, transparent);
}

.tailor-help__section h4 {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.tailor-help__section p,
.tailor-help__section li {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.tailor-help__section ul {
  margin: 8px 0 0;
  padding-left: 1.15em;
}

.tailor-help__section li + li {
  margin-top: 4px;
}

.entity-dialog__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.entity-dialog__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.entity-dialog__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.entity-dialog__actions .ghost-btn--danger {
  margin-right: auto;
  margin-left: 0;
}

.entity-dialog__error {
  font-size: 12px;
  color: #b14a55;
}

.entity-dialog__error[hidden] {
  display: none;
}

.field--toggle {
  margin-top: 4px;
}

.field--share {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  min-inline-size: 0;
}

.field--share legend {
  padding: 0;
  margin-bottom: 8px;
}

.field--share[disabled] {
  opacity: 0.65;
}

.share-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.share-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}

.share-option[hidden] {
  display: none !important;
}

.share-option input {
  margin-top: 3px;
  flex: 0 0 auto;
}

.share-option:has(input:checked) {
  border-color: var(--brand-purple-dark, #514399);
  background: var(--accent-soft, rgba(165, 147, 255, 0.12));
}

.share-option:has(input:focus-visible) {
  outline: 2px solid var(--accent, #a593ff);
  outline-offset: 2px;
}

.share-option__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.share-option__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.share-option__hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  position: relative;
}

.toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  z-index: 1;
}

.toggle__ui {
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
  margin-top: 2px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border);
  position: relative;
  transition: background 140ms ease, border-color 140ms ease;
}

.toggle__ui::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: transform 140ms ease;
}

.toggle input:checked + .toggle__ui {
  background: var(--brand-purple-dark, #514399);
  border-color: var(--brand-purple-dark, #514399);
}

.toggle input:checked + .toggle__ui::after {
  transform: translateX(16px);
}

.toggle input:focus-visible + .toggle__ui {
  outline: 2px solid var(--accent, #a593ff);
  outline-offset: 2px;
}

.toggle__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.toggle__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.toggle__hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.client-docs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.client-docs[hidden] {
  display: none;
}

.client-docs__hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.client-docs__dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.02);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.client-docs__dropzone:hover,
.client-docs__dropzone:focus-visible,
.client-docs__dropzone.is-dragover {
  border-color: var(--accent, #a593ff);
  background: rgba(81, 67, 153, 0.06);
  outline: none;
}

.client-docs__dropzone[hidden] {
  display: none;
}

.client-docs__dropzone-label {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.client-docs__browse {
  color: var(--brand-purple-dark, #514399);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.client-docs__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
}

.client-docs__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.03);
  font-size: 12px;
}

.client-docs__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 550;
  color: var(--text);
}

.client-docs__meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  text-transform: capitalize;
}

.client-docs__meta[data-status="failed"] {
  color: #b14a55;
}

.client-docs__meta[data-status="ready"] {
  color: #2f6b4f;
}

.client-docs__remove {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
}

.client-docs__remove:hover {
  color: #b14a55;
}

.client-docs__status {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.client-docs__status[data-tone="error"] {
  color: #b14a55;
}

.client-docs__status[hidden] {
  display: none;
}

.client-sites {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.client-sites[hidden] {
  display: none;
}

.client-sites__hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.client-sites__editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.client-sites__row {
  display: grid;
  grid-template-columns: minmax(7rem, 0.4fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.client-sites__row--primary {
  grid-template-columns: minmax(7rem, 0.4fr) minmax(0, 1fr);
}

.client-sites__title--fixed,
.client-sites__url--fixed {
  font-size: 13px;
  color: var(--text);
  min-width: 0;
}

.client-sites__title--fixed {
  font-weight: 600;
}

.client-sites__url--fixed a {
  color: var(--accent, #2f6fed);
  word-break: break-all;
}

.client-sites__save-status {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.client-sites__save-status[data-state="error"] {
  color: #b14a55;
}

.client-sites__save-status[data-state="ok"] {
  color: var(--muted);
}

.client-sites__save-status[hidden] {
  display: none;
}

.client-overview__sites-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.client-overview__sites-item {
  display: grid;
  grid-template-columns: minmax(5rem, 0.35fr) minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  font-size: 13px;
}

.client-overview__sites-title {
  font-weight: 600;
  color: var(--muted);
}

.client-overview__sites-item a {
  color: var(--accent, #2f6fed);
  word-break: break-all;
}

@media (max-width: 520px) {
  .client-sites__row,
  .client-sites__row--primary,
  .client-overview__sites-item {
    grid-template-columns: 1fr;
  }
}

.client-social {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.client-social[hidden] {
  display: none;
}

.client-social__hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.client-cbi {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.client-cbi__hint,
.client-cbi__note {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.client-cbi__note--error {
  color: var(--danger, #b42318);
}

.client-cbi__status {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text);
}

.client-cbi__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.client-cbi__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

@media (max-width: 520px) {
  .client-cbi__row {
    grid-template-columns: 1fr;
  }
}

.client-social__editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.client-social__row {
  display: grid;
  grid-template-columns: minmax(108px, auto) minmax(96px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 8px;
}

@media (max-width: 520px) {
  .client-social__row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .client-social__url-group {
    grid-column: 1 / -1;
  }

  .client-social__remove {
    grid-column: -2 / -1;
    justify-self: end;
  }
}

.client-social__platform,
.client-social__kind {
  flex: 0 0 auto;
  min-width: 110px;
  max-width: 140px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg, #fff);
  color: inherit;
  font-size: 13px;
}

.client-social__url-group {
  display: flex;
  align-items: stretch;
  min-width: 0;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg, #fff);
}

.client-social__prefix {
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.04);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

.client-social__handle {
  flex: 1 1 auto;
  min-width: 6rem;
  width: 100%;
  border: none;
  padding: 6px 8px;
  font-size: 13px;
  background: transparent;
  color: inherit;
}

.client-social__handle:focus {
  outline: none;
}

.client-social__url-group:focus-within {
  border-color: var(--accent, #a593ff);
}

.client-social__remove {
  flex: 0 0 auto;
  padding: 4px 8px;
  font-size: 12px;
}

.client-social__add {
  align-self: flex-start;
}

.client-social__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.client-social__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
  max-width: 100%;
}

.client-social__chip:hover {
  border-color: var(--accent, #a593ff);
}

.client-social__chip-name {
  font-weight: 600;
  text-transform: capitalize;
}

.client-social__chip-meta {
  color: var(--muted);
  font-size: 11px;
  text-transform: capitalize;
}

.client-social__chip-meta[data-status="ready"] {
  color: #2f6b4f;
}

.client-social__chip-meta[data-status="blocked"],
.client-social__chip-meta[data-status="error"] {
  color: #b14a55;
}

.client-social__chip-meta[data-status="pending"],
.client-social__chip-meta[data-status="empty"] {
  color: var(--muted);
}

.client-social__save-status {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.client-social__save-status[data-state="error"] {
  color: var(--danger, #c0392b);
}

.client-social__empty {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.client-social__empty[hidden] {
  display: none;
}

.field__hint {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.field__hint[hidden] {
  display: none;
}

.field__input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.client-item__title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.client-item__title-row .client-item__title {
  flex: 1 1 auto;
  min-width: 0;
}

.client-vis {
  flex: 0 0 auto;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--muted-2);
  opacity: 0.85;
}

.client-vis__icon {
  width: 14px;
  height: 14px;
  display: block;
}

.client-badge {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--brand-purple-dark, #514399);
  background: var(--accent-soft, rgba(165, 147, 255, 0.18));
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.4;
}

.client-badge--shared {
  color: var(--muted-2);
  background: rgba(0, 0, 0, 0.05);
}

.home-card__title-row .client-vis {
  margin-left: 8px;
}

.client-item--shared {
  cursor: default;
}

.wizard-client-chip__badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted-2);
  text-transform: uppercase;
}


/* CBI report status chip (R3) */
#clientCiChip { display: none; }
.cbi-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #eceff3;
  color: #44505c;
}
.cbi-chip[data-status="requested"],
.cbi-chip[data-status="in_progress"] {
  background: #fff3d6;
  color: #7a5200;
}
.cbi-chip[data-status="complete"] {
  background: #dcf5e4;
  color: #17612f;
}
.cbi-chip[data-status="failed"] {
  background: #fde3e1;
  color: #8f1d14;
}
.cbi-chip__time {
  margin: 0 8px;
  font-size: 12px;
  color: #6b7785;
}


/* Brand report: tabs, Creative Identity, summary, comparison */
.client-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 22px;
  padding: 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.client-tabs__tab {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  padding: 10px 16px 12px;
  font: inherit;
  font-size: 14px;
  letter-spacing: 0.01em;
  cursor: pointer;
  color: var(--muted);
}
.client-tabs__tab.is-active {
  color: var(--text);
  border-bottom-color: var(--brand-lime-dark);
  font-weight: 700;
}
.client-tabpanel__empty,
.ci-muted {
  color: var(--muted);
}
#clientTabSummary,
#clientTabCreative,
#clientTabCompetitive {
  padding-bottom: 28px;
}
.ci-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.ci-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.ci-nav__btn {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}
.ci-nav__btn[aria-pressed="true"] {
  background: var(--brand-black);
  border-color: var(--brand-black);
  color: var(--brand-white);
}
.ci-stage { display: grid; gap: 18px; }
.ci-exec__lede { margin: 8px 0 0; max-width: 68ch; color: var(--text); font-size: 16px; line-height: 1.45; }
.ci-exec__read { margin: 10px 0 4px; max-width: 74ch; color: var(--text); font-size: 14px; line-height: 1.55; }
.ci-comp-list { display: grid; gap: 12px; margin-top: 4px; }
.ci-comp-card {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}
.ci-comp-card h4 { margin: 0; font-size: 16px; }
.ci-comp-card h4 a { color: inherit; }
.ci-comp-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.ci-comp-badge {
  padding: 3px 8px;
  border-radius: 999px;
  background: #f3f0ea;
  color: #5c574e;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ci-comp-facts { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.ci-comp-sources { margin: 0; padding-left: 18px; font-size: 13px; }
.ci-comp-sources a { color: inherit; }
.ci-comp-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.ci-comp-table th {
  padding: 6px 12px 6px 0;
  text-align: left;
  color: #8a8478;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ci-comp-table td { padding: 8px 12px 8px 0; border-top: 1px solid #e4e0d8; vertical-align: top; }
.ci-comp-table a { color: inherit; font-weight: 600; }
.ci-exec__status {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  min-height: 28px;
  color: #8a8478;
  font-size: 12px;
}
.ci-exec__status.is-busy span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #1c1915;
}
.ci-exec__status.is-busy span::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #e4e0d8;
  border-top-color: #1a7f8c;
  animation: spin 0.85s linear infinite;
  flex-shrink: 0;
}
.ci-exec .ci-color-layout { grid-template-columns: 1fr; justify-items: center; }
.ci-exec .ci-legend { width: min(100%, 360px); }
.ci-exec .ci-diff { margin-top: 0; align-self: start; }
.ci-exec .ci-bar em { background: #c46b4a; }
.ci-exec__identity { grid-template-columns: minmax(220px, 320px) minmax(0, 1fr); }
.ci-exec-person b { display: inline-block; margin-top: 3px; }
.ci-standout { margin: 10px 0 0; padding-left: 18px; color: var(--text); font-size: 14px; line-height: 1.45; }
.ci-standout li + li { margin-top: 4px; }
.ci-exec__split {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.ci-radar { margin: 0; }
.ci-radar svg { display: block; width: 100%; height: auto; }
.ci-radar text { fill: #1c1915; font-size: 11px; font-family: inherit; }
.ci-radar__tick { fill: #8a8478; font-size: 9px; }
.ci-radar figcaption { margin-top: 2px; text-align: center; color: #8a8478; font-size: 12px; }
.ci-pillar-list,
.ci-theme-bars,
.ci-exec-phrases { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.ci-pillar-list li,
.ci-theme-bars li,
.ci-exec-phrases li {
  display: grid;
  grid-template-columns: minmax(88px, 140px) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.ci-theme-bars li { grid-template-columns: minmax(100px, 160px) minmax(0, 1fr) auto auto; }
.ci-pillar-list i,
.ci-theme-bars i {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: #efece6;
  overflow: hidden;
}
.ci-pillar-list b,
.ci-theme-bars b { display: block; height: 100%; border-radius: inherit; background: #1a7f8c; }
.ci-pillar-list b.is-gap { background: #c46b4a; }
.ci-standout li.is-gap { color: #c46b4a; }
.ci-pillar-list strong,
.ci-theme-bars strong,
.ci-exec-phrases b { font-variant-numeric: tabular-nums; }
.ci-theme-bars em { color: #8a8478; font-style: normal; font-size: 12px; }
.ci-exec-people { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.ci-exec-person {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}
.ci-exec-person__photo { width: 52px; height: 52px; border-radius: 10px; overflow: hidden; background: #f3f0ea; }
.ci-exec-person__photo .ci-img { width: 52px; height: 52px; object-fit: cover; }
.ci-exec-person--text { grid-template-columns: minmax(0, 1fr); }
.ci-map { margin: 4px 0 0; }
.ci-map svg { display: block; width: 100%; height: auto; }
.ci-map__zone { fill: #b0aa9e; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; }
.ci-map__spoke { stroke: #d9d3c8; stroke-width: 2; }
.ci-map__spoke--open { stroke: #e4e0d8; stroke-dasharray: 4 4; }
.ci-map__center { fill: #1c1915; }
.ci-map__bubble { fill: #fff; stroke: #1a7f8c; stroke-width: 2.5; }
.ci-map__bubble--open { stroke: #c9c3b8; stroke-dasharray: 5 4; }
.ci-map__name { fill: #1c1915; font-size: 12px; font-weight: 700; }
.ci-map__score { fill: #6f6a62; font-size: 11px; }
.ci-map__brand { fill: #fff; font-size: 14px; font-weight: 700; }
.ci-map__brand-score { fill: #d6e34a; font-size: 18px; font-family: Georgia, "Iowan Old Style", Palatino, serif; }
.ci-map__legend {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 2px;
  color: #8a8478;
  font-size: 12px;
}
.ci-exec-person h4 { margin: 0; font-size: 14px; }
.ci-exec-person b { color: var(--text); font-size: 13px; }
.ci-exec-person p { margin: 2px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.ci-exec-phrases li { grid-template-columns: minmax(0, 1fr) auto; }
.ci-exec .ci-shots { margin-top: 12px; }
@media (max-width: 800px) {
  .ci-exec__split { grid-template-columns: 1fr; }
}
.ci-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.ci-label + .ci-kicker { margin-top: 12px; }
}
.ci-lede,
.ci-copy {
  margin: 0;
  max-width: 72ch;
  color: #2c2924;
  font-size: 14px;
  line-height: 1.45;
}
.ci-copy { font-size: 15px; line-height: 1.6; color: var(--muted); }
.ci-stage > .ci-label:not(:first-child) { margin-top: 28px; }
.ci-label + .ci-copy,
.ci-label + .ci-color-layout { margin-top: 14px; }
.ci-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #e4e0d8;
}
.ci-heading .ci-label {
  margin: 0;
  padding: 0;
  border: 0;
}
.ci-version {
  flex: 0 0 auto;
  color: #8a8478;
  font-size: 12px;
  font-weight: 500;
}
.ci-label {
  margin: 8px 0 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #e4e0d8;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: #000;
}
.ci-scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ci-score {
  display: grid;
  gap: 8px;
  padding: 16px 16px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}
.ci-score header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.ci-score h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.ci-score header b,
.comp-score b {
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
.ci-score p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.ci-meter {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: #ece8e1;
  overflow: hidden;
}
.ci-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-lime-dark), var(--brand-lime));
}
.ci-factors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin: 4px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--border);
  list-style: none;
}
.ci-factors li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.ci-factors b { color: var(--text); font-weight: 700; }
.ci-people { display: grid; gap: 14px; }
.ci-person {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.ci-person--text { grid-template-columns: minmax(0, 1fr); }
.ci-person__more { grid-column: 1 / -1; }
.ci-person__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.ci-action {
  appearance: none;
  margin: 0;
  padding: 5px 11px;
  border: 1px solid #e4e0d8;
  border-radius: 999px;
  background: #f6f4ef;
  color: #6f6a62;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
}
.ci-action--path { margin-left: auto; }
.ci-action:hover { color: var(--text); border-color: #d4cfc6; }
.ci-action:disabled {
  color: #8a8478;
  cursor: progress;
  opacity: 0.75;
}
.ci-action[aria-expanded="true"] {
  background: #1c1915;
  border-color: #1c1915;
  color: #fff;
}
.ci-panel {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid #e4e0d8;
}
.ci-panel[hidden] { display: none; }
.ci-eval p { margin: 0 0 10px; color: var(--text); font-size: 14px; line-height: 1.5; }
.ci-eval__outcome { font-weight: 700; }
.ci-eval h5 {
  margin: 12px 0 4px;
  color: #8a8478;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.ci-eval ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.ci-eval li + li { margin-top: 4px; }
.ci-path__name {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}
.ci-steps { list-style: none; margin: 0; padding: 0; }
.ci-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  position: relative;
  padding-bottom: 18px;
}
.ci-step:last-child { padding-bottom: 0; }
.ci-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: 0;
  width: 1px;
  background: #e4e0d8;
}
.ci-step__n {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1c1915;
  color: var(--brand-lime);
  font-size: 12px;
  font-weight: 700;
}
.ci-step__body h5 { margin: 3px 0 4px; font-size: 15px; }
.ci-step__body p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.ci-step__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 8px;
  color: var(--muted-2);
  font-size: 12px;
}
.ci-step__meta span { display: inline-flex; align-items: center; gap: 8px; }
.ci-step__meta .ci-meter { width: 56px; }
.ci-step__meta b { color: var(--text); font-size: 13px; }
.ci-step__meta a { color: var(--brand-purple-dark); }
.ci-step .ci-shot { max-width: 280px; margin-top: 10px; }
.ci-field {
  margin: 14px 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  color: #8a8478;
}
.ci-journey { display: grid; gap: 12px; margin-top: 10px; }
.ci-journey__line { display: grid; gap: 2px; margin: 0; }
.ci-journey__line--inline { display: flex; gap: 8px; align-items: baseline; }
.ci-journey__line .ci-field { margin: 0; }
.ci-journey__line b { font-weight: 700; color: var(--text); }
.ci-person__media {
  align-self: start;
  width: 148px;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
}
.ci-person__media .ci-img {
  display: block;
  width: 100%;
  height: auto;
}
.ci-monogram {
  width: 100%;
  height: 112px;
  object-fit: cover;
}
.ci-monogram {
  display: grid;
  place-items: center;
  color: var(--brand-lime);
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-size: 42px;
}
.ci-person__body h3 { margin: 0 0 6px; font-size: 20px; }
.ci-person__body p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.ci-motives,
.ci-journeys,
.ci-phrases {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.ci-motives li,
.ci-phrases li {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--brand-purple-dark);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}
.ci-phrases li small {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 700;
}
.ci-phrases--quiet li { background: var(--surface); color: var(--text); }
.ci-journeys { display: grid; gap: 6px; }
.ci-journeys li {
  display: grid;
  gap: 12px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}
.ci-journeys b {
  min-width: 1.2em;
  color: var(--brand-lime-dark);
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
}
.ci-palette {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}
.ci-tile {
  min-height: 132px;
  margin: 0;
  padding: 12px;
  display: flex;
  align-items: flex-end;
  border-radius: 14px;
  background: var(--swatch);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.ci-tile figcaption { display: grid; gap: 2px; }
.ci-tile b {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
}
.ci-tile span { font-family: Georgia, "Iowan Old Style", Palatino, serif; font-size: 22px; line-height: 1; }
.ci-tile small { opacity: 0.85; font-size: 11px; }
.ci-color-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  margin-top: 16px;
}
.ci-pie { margin: 0; }
.ci-pie svg { display: block; width: 200px; height: 200px; margin: 0 auto; }
.ci-pie figcaption {
  margin-top: 8px;
  text-align: center;
  color: #8a8478;
  font-size: 12px;
  font-weight: 600;
}
.ci-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ci-legend li {
  display: grid;
  grid-template-columns: 16px 78px 52px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.ci-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}
.ci-swatch--light { box-shadow: inset 0 0 0 1px #c9ced6; }
.ci-legend span {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.03em;
}
.ci-legend b { font-variant-numeric: tabular-nums; text-align: right; }
.ci-legend em {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: #efece6;
  overflow: hidden;
}
.ci-legend em i { display: block; height: 100%; border-radius: inherit; }
.ci-diff {
  margin-top: 28px;
  padding: 18px 18px 16px;
  border-radius: 16px;
  background: #1c1915;
  color: #f4f1ea;
}
.ci-diff .ci-label { color: #fff; border-bottom-color: rgba(255, 255, 255, 0.16); }
.ci-diff__score { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 8px; }
.ci-diff__score b {
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-size: 40px;
  line-height: 1;
  color: #d6e34a;
}
.ci-diff__score span { color: #b9b3a8; font-size: 13px; }
.ci-diff p { margin: 0; color: #e7e2d8; font-size: 14px; line-height: 1.55; }
.ci-narratives { display: grid; gap: 12px; margin-top: 14px; }
.ci-narratives article {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}
.ci-narratives h4 { margin: 0 0 6px; font-size: 15px; }
.ci-narratives p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
@media (max-width: 720px) {
  .ci-color-layout { grid-template-columns: 1fr; }
}
.ci-quote {
  margin: 0;
  padding: 4px 0 4px 16px;
  border-left: 4px solid var(--brand-lime);
  color: var(--text);
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-size: 20px;
  line-height: 1.4;
}
.ci-bars { display: grid; gap: 8px; }
.ci-bar {
  display: grid;
  grid-template-columns: minmax(90px, 140px) 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.ci-bar b { font-variant-numeric: tabular-nums; }
.ci-bar i {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: #ece8e1;
  overflow: hidden;
}
.ci-bar em {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-purple);
}
.ci-pages { display: grid; gap: 10px; }
.ci-page {
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.ci-page h4 { margin: 0 0 6px; font-size: 14px; }
.ci-page h4 a { color: var(--brand-purple-dark); text-underline-offset: 2px; }
.ci-page p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.ci-imagery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.ci-panel-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}
.ci-kicker {
  margin: 0 0 4px;
  color: #8a8478;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ci-panel-card .ci-label { font-size: 18px; }
.ci-themes { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 18px; }
.ci-theme__top {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  gap: 6px 12px;
  align-items: baseline;
}
.ci-theme__n { color: #8a8478; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ci-theme__top h4 { margin: 0; font-size: 16px; }
.ci-theme__meta { color: #8a8478; font-size: 12px; white-space: nowrap; }
.ci-theme__seen { margin: 6px 0 0 40px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.ci-theme__shots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 0 40px;
}
.ci-theme__shots .ci-shot figcaption { font-size: 11px; }
.ci-obs__count { margin: 12px 0 0; color: var(--text); font-size: 13px; }
.ci-obs { list-style: none; margin: 8px 0 0; padding: 0; }
.ci-obs li {
  display: grid;
  gap: 2px;
  padding: 10px 0;
  border-top: 1px solid #e4e0d8;
}
.ci-obs strong { font-size: 14px; }
.ci-obs a { color: inherit; }
.ci-obs a:hover { color: var(--brand-purple-dark); }
.ci-obs span { color: var(--muted); font-size: 12px; }
@media (max-width: 800px) {
  .ci-imagery { grid-template-columns: 1fr; }
  .ci-theme__top { grid-template-columns: 28px minmax(0, 1fr); }
  .ci-theme__seen,
  .ci-theme__shots { margin-left: 0; }
}
.ci-shots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ci-shot {
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: zoom-in;
}
.ci-shot__frame {
  display: grid;
  place-items: center;
  min-height: 180px;
  background:
    linear-gradient(45deg, #f3f0ea 25%, transparent 25%),
    linear-gradient(-45deg, #f3f0ea 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f3f0ea 75%),
    linear-gradient(-45deg, transparent 75%, #f3f0ea 75%);
  background-size: 16px 16px;
  background-color: #fff;
}
.ci-shot .ci-img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  object-position: top center;
  background: transparent;
}
.ci-shot figcaption {
  padding: 8px 12px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.ci-shots--pages {
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
}
.ci-shots--pages .ci-shot__frame { min-height: 96px; }
.ci-shots--pages .ci-img { max-height: 110px; }
.ci-shots--pages figcaption {
  padding: 6px 8px 8px;
  font-size: 11px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ci-shots--pages figcaption a { color: var(--brand-purple-dark); }
.ci-shots--faces { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.ci-shots--faces .ci-shot__frame { min-height: 140px; }
.ci-img { max-width: 100%; display: block; }
.ci-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 28px;
  background: rgba(18, 16, 14, 0.88);
}
.ci-lightbox[hidden] { display: none; }
.ci-lightbox img {
  max-width: min(1100px, 92vw);
  max-height: 78vh;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
}
.ci-lightbox p { margin: 0; color: #fff; font-size: 14px; }
.ci-lightbox__close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
@media (max-width: 720px) {
  .ci-scores,
  .ci-shots,
  .ci-person,
  .ci-factors { grid-template-columns: 1fr; }
}

/* Brand Summary (R5) */
.summary-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.summary-body h4 {
  margin: 22px 0 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.summary-body p { margin: 0 0 12px; max-width: 68ch; font-size: 16px; line-height: 1.6; }
.summary-origin {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--ok-soft);
  color: #3d5200;
}

.comp-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.comp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.comp-row__main { display: grid; gap: 2px; }
.comp-row__tag { font-size: 12px; color: var(--muted); }
.comp-row__why { margin: 0; font-size: 13px; color: var(--muted); }
.comp-row__actions { display: flex; gap: 8px; flex-shrink: 0; }
.comp-add {
  display: grid;
  gap: 10px;
  max-width: 460px;
  margin-top: 8px;
  padding: 16px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
}
.comp-add__label { display: grid; gap: 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.comp-add__label input,
.comp-add__label select { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 14px; }
.comp-add__msg { margin: 0; font-size: 13px; min-height: 1em; }
.comp-view { margin: 0 0 18px; }
.comp-note { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.comp-actions { display: flex; gap: 8px; margin: 8px 0 14px; }
.comp-table { border-collapse: collapse; width: 100%; margin: 8px 0 16px; background: var(--panel); border-radius: 12px; overflow: hidden; }
.comp-table th, .comp-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.comp-table thead th { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.comp-score { display: flex; align-items: center; gap: 10px; }
.comp-score .ci-meter { width: 72px; flex: 0 0 72px; }
.comp-score b { font-size: 20px; }
.comp-narrative h4 { margin: 16px 0 6px; }
.comp-narrative h5 { margin: 8px 0 2px; }
.comp-narrative p { max-width: 68ch; line-height: 1.55; }
.comp-link { width: 100%; max-width: 560px; margin-top: 4px; }

/* Open access: a brand that is not in the viewer's default lists (R10). */
.brand-hidden-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0 0.4rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.7;
  vertical-align: middle;
}

.workspace-search__item.is-hidden-brand {
  opacity: 0.7;
}
