/* Personae v2.0 — the `personae` modality design system (D34/K8, §6.15.7).
   Copyright (c) 2025-2026 Mass Cognition all rights reserved.

   Design tokens are CSS custom properties. The neutral theme below is the
   shipped default; bespoke/theme.json (server-validated) may override the
   --pa-* colour tokens only. The token set is a versioned interface
   (6.15.7): tokens may be added in later versions, never renamed.

   Colour token set v1:
     --pa-bg              page background
     --pa-surface         rail, cards, bubbles, inputs
     --pa-border          hairlines and input borders
     --pa-text            primary text
     --pa-text-muted      secondary text
     --pa-accent          brand accent: active nav, buttons, links
     --pa-accent-contrast text/icons on the accent colour
     --pa-user-bubble     user chat bubble background
     --pa-bot-bubble      assistant chat bubble background
     --pa-danger          destructive actions and error text
   Later additions: --pa-rail-bg, --pa-main-bg, --pa-tools-bg (round 3);
   --pa-rail-text (2026-10-30), the rail's plain text (captions and the
   footer) - it has no :root value, each rule falling back to the colour
   it had before; and --pa-rail-button / --pa-rail-button-text
   (2026-10-30), the solid rail pills.
*/

:root {
  --pa-bg: #f4f6f8;
  --pa-surface: #ffffff;
  --pa-border: #dfe3e8;
  --pa-text: #1d2429;
  --pa-text-muted: #64707a;
  --pa-accent: #33648a;
  --pa-accent-contrast: #ffffff;
  --pa-user-bubble: #e3ecf3;
  --pa-bot-bubble: #ffffff;
  --pa-danger: #b4232a;
  /* Round-3 panel tokens (2026-10-26): per-panel recolour via theme.json;
     the defaults reference the base tokens, so nothing changes until a
     client sets them. */
  --pa-rail-bg: var(--pa-surface);
  --pa-main-bg: var(--pa-bg);
  --pa-tools-bg: transparent;
  /* Solid rail pills (owner 2026-10-30). */
  --pa-rail-button: #2f3437;
  --pa-rail-button-text: #ffffff;

  /* Non-colour design constants (not themeable). */
  --pa-radius: 10px;
  --pa-rail-width: 232px;
  --pa-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
             "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--pa-font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--pa-text);
  background: var(--pa-bg);
  /* Round 2: the brand band spans above rail + main; the shell below gets
     the remaining viewport and each region scrolls itself. */
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

a { color: var(--pa-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; color: var(--pa-text); }

/* ---- Brand band (6.15.7 item 5; two rows, layout amended 2026-10-29) ---- */
/* v1.6.4's arrangement: row 1 is the customisation area across the full
   band (the client's banner, or the client-name title); row 2 beneath it is
   the page's description - hero in a fixed box on the left, the intro to its
   right. Themeable via the surface/border/text tokens. */

.brandBand {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  /* 6.15.7 "Conversation space at least v1's" (2026-11-01): row 2's
     padding and the gap are trimmed; row 1 (the banner) is unchanged. */
  gap: 4px;
  padding: 4px clamp(12px, 3vw, 36px);
  background: var(--pa-surface);
  border-bottom: 1px solid var(--pa-border);
}

/* Row 1: the banner or title, nothing else shares it. */
.bandRow1 {
  min-width: 0;
}

.brandTitle {
  margin: 0;
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 600;
  color: var(--pa-text);
  overflow-wrap: anywhere;
}

/* "Banner fills the area" (6.15.7 item 5, owner 2026-10-29): the box has
   a defined 8:1 shape at the full band width, its height capped at 200px
   (reached at a 1600px band). The image is cover-fitted and centred: it
   always fills the box, and another shape is cropped evenly instead of
   letterboxed. These values are personae/branding.py's BANNER_ASPECT and
   BANNER_MAX_HEIGHT_PX (pinned by test), which the Branding page states. */
.slotBannerTop {
  width: 100%;
  aspect-ratio: 8 / 1;
  max-height: 200px;
  overflow: hidden;
}

.slotBannerTop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Row 2: hero on the left, the intro filling the remaining width,
   top-aligned with the hero. Always shown (owner 2026-10-30). */
.bandRow2 {
  display: flex;
  align-items: stretch;
  gap: clamp(12px, 2vw, 24px);
  min-width: 0;
}

/* D29 discipline: the box owns its geometry; any artwork fits inside,
   nothing derives from the image's intrinsic size. 6.15.7 item 7 (owner
   2026-11-02): a clear square of about 150 px at the top of the rail (the
   rail's inner width at most), on chat and concept alike. */
.slotBrand {
  flex: 0 0 auto;
  width: min(150px, 100%);
  aspect-ratio: 1 / 1;
  height: auto;
  margin: 0 auto 10px;  /* centred in the rail */
  overflow: hidden;
  position: relative;
}

/* The hero fills its square box; other shapes are cropped evenly (the
   Branding page says so - 6.15.8 item 3). */
/* Absolutely placed, so the artwork's intrinsic size never sizes the box
   (a 512 px hero otherwise held row 2 at the 72 px maximum). */
.slotBrand img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* The intro wraps in the remaining width and is always shown in full - no
   clamp, no collapse (2026-10-29/30 rulings): row 2's height follows it. */
.bandIntro {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--pa-text-muted);
  overflow-wrap: anywhere;
}

/* The rail toggle is fixed at the top-left at these widths; row 1 starts
   clear of it. */
@media (max-width: 860px) {
  .bandRow1 {
    padding-left: 48px;
  }
}

@media (max-width: 640px) {
  .bandIntro { font-size: 13px; }
}

/* ---- Shell: rail + main ------------------------------------------------- */

.shell { flex: 1 1 auto; display: flex; min-height: 0; }

#navRail {
  flex: 0 0 var(--pa-rail-width);
  display: flex;
  flex-direction: column;
  background: var(--pa-rail-bg);
  border-right: 1px solid var(--pa-border);
  padding: 14px 12px;
  gap: 4px;
  height: 100%;
  overflow-y: auto;
}

/* D29 banner slot: a fixed-geometry box — the rail brand area. No page
   dimension derives from the artwork (6.15.7 item 3). */
.slotBanner {
  height: 56px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.slotBanner img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* .railTitle removed (round 2): the client name lives in the brand band. */

.railSection {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--pa-rail-text, var(--pa-text-muted));
  margin: 14px 8px 4px;
}

/* Solid v1-style pills (owner 2026-10-30): charcoal with white semi-bold
   text; hover and keyboard focus invert between the pill's own pair
   (rail-button-text background, rail-button text and border), readable on
   any rail; the current page is accent. Every state has a 1px border
   (transparent unless inverted), so nothing shifts by a pixel. About 6px
   apart (the rail's 4px gap plus 2px) and inset from the rail's sides.
   No state rule re-shapes or re-pads a pill. */
.railLink {
  display: block;
  margin: 0 4px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--pa-rail-button);
  color: var(--pa-rail-button-text);
  font-weight: 600;
}

.railLink + .railLink { margin-top: 2px; }

.railLink:hover,
.railLink:focus-visible {
  background: var(--pa-rail-button-text);
  color: var(--pa-rail-button);
  border-color: var(--pa-rail-button);
  text-decoration: none;
  outline: none;
}

.railLink.active {
  background: var(--pa-accent);
  color: var(--pa-accent-contrast);
  border-color: transparent;
}

.railFoot {
  margin-top: auto;
  padding: 10px 8px 2px;
  border-top: 1px solid var(--pa-border);
  font-size: 12.5px;
  color: var(--pa-rail-text, var(--pa-text-muted));
  overflow-wrap: anywhere;
}

.railFoot a {
  display: inline-block;
  margin-top: 4px;
  color: var(--pa-rail-text, var(--pa-accent));
}

/* 6.15.8: the "Powered by Mass Cognition" credit, the footer's last line.
   The footer already sits at the rail's foot (margin-top: auto), so this
   only grows it upward into the rail's empty space. */
.railFoot .poweredBy {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--pa-rail-text, var(--pa-text-muted));
}

.railFoot .poweredBy a {
  display: inline;
  margin-top: 0;
  color: inherit;
  font-weight: 600;
}

/* Usage meter (account status, polled from /get_quest_usage). */
.usageMeter {
  height: 6px;
  border-radius: 3px;
  background: var(--pa-border);
  overflow: hidden;
  margin: 6px 0 2px;
}

.usageMeter > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--pa-accent);
  transition: width 0.4s;
}

.shellMain {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--pa-main-bg);
}

/* Mobile rail toggle. */
#railToggle {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 60;
  border: 1px solid var(--pa-border);
  background: var(--pa-surface);
  color: var(--pa-text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 860px) {
  #railToggle { display: block; }
  #navRail {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.12);
  }
  body.railOpen #navRail { transform: translateX(0); }
}

/* ---- Auth pages (login / register / terms) ------------------------------ */

.authWrap {
  /* Round 9: no hard centring - body is 100vh/overflow-hidden, and a
     centred flex column taller than the viewport clips its top
     unreachably. Auto margins on the card/footer centre the group only
     when it fits; otherwise the wrap scrolls from the top. */
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  padding: 24px;
}

.authCard {
  margin-top: auto;
  width: 100%;
  max-width: 420px;
  background: var(--pa-surface);
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius);
  padding: 28px;
}

.authCard h1 { font-size: 20px; margin: 0 0 18px; text-align: center; }

.authBanner { margin-bottom: 10px; }

.fieldLabel {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 12px 0 4px;
}

.authFoot {
  margin-top: 26px;
  margin-bottom: auto;
  font-size: 11.5px;
  color: var(--pa-text-muted);
  text-align: center;
  max-width: 480px;
}

.pageDoc {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px;
  background: var(--pa-surface);
}

/* ---- Chat screen --------------------------------------------------------- */

.chatScreen {
  display: flex;
  flex-direction: column;
  /* Round 2: the shell owns the viewport; the chat screen fills the main
     region below the brand band instead of assuming 100vh. */
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  padding: 0 clamp(12px, 3vw, 36px);
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.chatHeader {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px 2px 12px;
  border-bottom: 1px solid var(--pa-border);
}

/* .slotHero removed (round 2): the page graphic renders in the brand
   band's .slotBrand box. */

/* 6.15.7 item 7 (owner 2026-11-02): one compact, right-aligned row
   directly above the transcript. Still the client-recolourable strip
   (round-3 addendum). */
.chatTools {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 2px 0;
  background: var(--pa-tools-bg);
  border-bottom: 1px solid var(--pa-border);
}

.chatTools .toolBtn { font-size: 12px; padding: 3px 10px; }

.toolBtn {
  border: 1px solid var(--pa-border);
  background: var(--pa-surface);
  color: var(--pa-text);
  font: inherit;
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-block;
}

.toolBtn:hover { border-color: var(--pa-accent); text-decoration: none; }

/* Conversation. */
#chatbox {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 2px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  max-width: 76%;
  padding: 10px 14px;
  border-radius: var(--pa-radius);
  border: 1px solid var(--pa-border);
  overflow-wrap: break-word;
}

.msg.user {
  align-self: flex-end;
  background: var(--pa-user-bubble);
  white-space: pre-wrap;
}

.msg.bot {
  align-self: flex-start;
  background: var(--pa-bot-bubble);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.msg.bot img.botAvatar {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  object-fit: cover;
}

.msg.bot .msgContent {
  flex: 1 1 auto;
  min-width: 0;
}

/* 6.8.6: the per-reply copy icon. */
.msg.bot .copyIcon {
  flex: 0 0 auto;
  align-self: flex-end;
  padding: 2px;
  border: 0;
  background: transparent;
  color: var(--pa-text-muted);
  cursor: pointer;
  line-height: 0;
}

.msg.bot .copyIcon:hover,
.msg.bot .copyIcon:focus-visible { color: var(--pa-text); }

.msg.bot .copyIcon.copied { color: var(--pa-accent); }

.msg.bot pre {
  overflow-x: auto;
  background: var(--pa-bg);
  padding: 8px;
  border-radius: 6px;
}

.msg.bot table { border-collapse: collapse; }

.msg.bot td, .msg.bot th {
  border: 1px solid var(--pa-border);
  padding: 4px 8px;
}

.msg .attachmentNote {
  display: block;
  font-size: 12px;
  color: var(--pa-text-muted);
}

.msg img.attachmentThumb {
  max-width: 180px;
  max-height: 120px;
  object-fit: contain;
  display: block;
  border-radius: 6px;
  margin-bottom: 4px;
}

/* Composer. */
#composer {
  border-top: 1px solid var(--pa-border);
  padding: 6px 2px 4px;
  background: var(--pa-main-bg);
}

#filePreviewContainer {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--pa-text-muted);
  padding: 4px 2px 8px;
}

#filePreviewContainer.hasFile { display: flex; }

/* 6.8.7 / 6.11.6: the staged file - a thumbnail up to 60px or a document
   icon, its name, and for a small TXT its opening characters. */
#filePreview {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.filePreviewThumb {
  max-width: 60px;
  max-height: 60px;
  object-fit: contain;
  border-radius: 4px;
}

.filePreviewSnippet {
  font-size: 11px;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.docIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 38px;
  height: 46px;
  padding: 0 4px;
  border: 1px solid var(--pa-border);
  border-radius: 4px 12px 4px 4px;
  background: var(--pa-surface);
  color: var(--pa-text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.docIcon[data-kind="pdf"] { color: #b3261e; }
.docIcon[data-kind="docx"] { color: #1f5fae; }

/* The upload button is hidden while a file is staged. */
#uploadButton[hidden], #conceptUploadButton[hidden] { display: none; }

.msg.user .bubbleAttachment {
  display: block;
  margin-bottom: 4px;
}

.composerRow {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

#textInputArea {
  flex: 1 1 auto;
  resize: none;
  min-height: 44px;
  max-height: 180px;
  padding: 10px 12px;
  font: inherit;
  color: var(--pa-text);
  background: var(--pa-surface);
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius);
}

#textInputArea:focus, .form-control:focus {
  outline: 2px solid var(--pa-accent);
  outline-offset: -1px;
}

.iconBtn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: var(--pa-radius);
  border: 1px solid var(--pa-border);
  background: var(--pa-surface);
  color: var(--pa-text);
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.iconBtn.primary {
  background: var(--pa-accent);
  border-color: var(--pa-accent);
  color: var(--pa-accent-contrast);
}

/* 6.15.7 item 6 (owner 2026-11-02): always on screen under the composer
   row; its space comes from tight margins, not from the banner or intro. */
.composerHint {
  margin: 2px 0 0;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--pa-text-muted);
}

/* Segment picker (D30/R22). */
#segmentPicker { position: relative; }

#segmentPickerPanel {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  z-index: 40;
  background: var(--pa-surface);
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius);
  padding: 12px;
  min-width: 220px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

#segmentList { display: flex; flex-direction: column; gap: 4px; }

#segmentList label { font-size: 13px; }

/* ---- Generic components (also dress the retained admin templates) ------- */

.container { width: 92%; max-width: 1080px; margin-left: auto; margin-right: auto; }

.row { display: flex; flex-wrap: wrap; gap: 0 16px; }

.row.justify-content-center { justify-content: center; }

[class^="col-"], [class*=" col-"] { flex: 1 1 0; min-width: 0; }

.col-md-3 { flex: 0 0 23%; }
.col-md-4 { flex: 0 0 31%; }
.col-md-6 { flex: 0 0 48%; }
.col-md-8 { flex: 0 0 64%; }
.col-md-10 { flex: 0 0 80%; }
.col-md-12, .col-12 { flex: 0 0 100%; }
.col-md-1 { flex: 0 0 7%; }
.col-md-11 { flex: 0 0 89%; }

@media (max-width: 760px) {
  [class^="col-"], [class*=" col-"] { flex: 0 0 100%; }
}

.card {
  background: var(--pa-surface);
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius);
  margin-bottom: 16px;
}

.card-header { padding: 12px 16px; border-bottom: 1px solid var(--pa-border); }

.card-body { padding: 16px; }

.btn {
  display: inline-block;
  border: 1px solid var(--pa-accent);
  background: var(--pa-accent);
  color: var(--pa-accent-contrast) !important;
  font: inherit;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: calc(var(--pa-radius) - 2px);
  cursor: pointer;
  text-decoration: none !important;
}

.btn:hover { filter: brightness(0.92); }

.btn-danger, .btn.danger { background: var(--pa-danger); border-color: var(--pa-danger); }

.btn-secondary {
  background: var(--pa-surface);
  border-color: var(--pa-border);
  color: var(--pa-text) !important;
}

.form-group { margin-bottom: 14px; }

.form-control, .form-control-file,
input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  color: var(--pa-text);
  background: var(--pa-surface);
  border: 1px solid var(--pa-border);
  border-radius: calc(var(--pa-radius) - 2px);
}

input[type="checkbox"], input[type="radio"] { width: auto; }

.form-check { display: flex; gap: 6px; align-items: center; }

.form-text, .text-muted { color: var(--pa-text-muted); font-size: 12.5px; }

.alert {
  padding: 10px 14px;
  border-radius: calc(var(--pa-radius) - 2px);
  border: 1px solid var(--pa-border);
  background: var(--pa-bg);
  margin-bottom: 14px;
}

.alert-danger, .alert-warning { border-color: var(--pa-danger); color: var(--pa-danger); }

.alert-success { border-color: var(--pa-accent); color: var(--pa-accent); }

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--pa-bg);
  border: 1px solid var(--pa-border);
}

/* 6.13 amendment (2026-10-31): tables stay inside their card (this file
   replaces Bootstrap, which used to supply these). Long ids wrap; badges and
   buttons never do; horizontal scrolling is only a last resort. */
.table-responsive { width: 100%; max-width: 100%; overflow-x: auto; }
.table { width: 100%; max-width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--pa-border);
}
.table-sm th, .table-sm td { padding: 5px 8px; }
.table .cell-wrap { overflow-wrap: anywhere; word-break: break-word; }
.table .badge, .table .btn, .text-nowrap { white-space: nowrap; }
.badge { white-space: nowrap; }
/* 6.13 status colours (Bootstrap used to supply them): muted, and readable
   on the card (each at least 4.5:1 against its text). */
.badge-success { background: #2e7d4f; border-color: #2e7d4f; color: #ffffff; }
.badge-primary { background: var(--pa-accent); border-color: var(--pa-accent);
                 color: var(--pa-accent-contrast); }
.badge-warning { background: #e3bd52; border-color: #e3bd52; color: #1d2429; }
.badge-danger { background: var(--pa-danger); border-color: var(--pa-danger);
                color: #ffffff; }
.badge-secondary { background: #5f6b74; border-color: #5f6b74; color: #ffffff; }

.list-group { padding: 0; margin: 0; list-style: none; }

.list-group-item {
  display: block;
  padding: 10px 14px;
  border: 1px solid var(--pa-border);
  border-bottom-width: 0;
  background: var(--pa-surface);
  color: var(--pa-text);
}

.list-group-item:last-child { border-bottom-width: 1px; }

.list-group-item-action:hover { background: var(--pa-bg); text-decoration: none; }

.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.text-center { text-align: center; }

table { width: 100%; border-collapse: collapse; }

th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--pa-border); }

.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 24px; } .mb-1 { margin-bottom: 4px; } .mb-3 { margin-bottom: 12px; }

/* Minimal modal (replaces the Bootstrap JS the old base pulled from a CDN). */
.modal { display: none; position: fixed; inset: 0; z-index: 100; }

.modal.show { display: block; }

.modal::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-dialog {
  position: relative;
  max-width: 480px;
  margin: 10vh auto;
  z-index: 101;
}

.modal-content {
  background: var(--pa-surface);
  border-radius: var(--pa-radius);
  border: 1px solid var(--pa-border);
}

.modal-header, .modal-footer { padding: 12px 16px; }

.modal-header { border-bottom: 1px solid var(--pa-border); }

.modal-footer {
  border-top: 1px solid var(--pa-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-body { padding: 16px; }

.footer {
  text-align: center;
  font-size: 11.5px;
  color: var(--pa-text-muted);
  padding: 18px 0;
}

/* ---- Concept screen ------------------------------------------------------ */

.conceptGrid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr);
  gap: 20px;
  padding: 16px 2px;
}

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

.conceptEntry .title-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

#conceptInputArea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  margin-bottom: 8px;
}

.conceptSpec {
  background: var(--pa-surface);
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius);
  padding: 16px;
}

#sizeBtnHolder { display: flex; gap: 6px; flex-wrap: wrap; }

/* 6.11.8 step 1: the form is inert while a run is in progress. */
.runLocked .sizeBtn,
.runLocked .personaTrigger { pointer-events: none; opacity: 0.6; }

#newConButton[aria-disabled="true"] { cursor: not-allowed; opacity: 0.5; }

#conceptResult .loader {
  width: 28px;
  height: 28px;
  margin: 8px 0 2px;
  border: 3px solid var(--pa-border);
  border-top-color: var(--pa-accent);
  border-radius: 50%;
  animation: conceptSpin 0.9s linear infinite;
}

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

#conceptResult .requestDetails {
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius);
  background: var(--pa-surface);
}

#conceptResult .requestDetails p { margin: 2px 0; }
#conceptResult .requestDetailsTitle { font-weight: 600; }

.sizeBtn.active, .toolBtn.active {
  background: var(--pa-accent);
  border-color: var(--pa-accent);
  color: var(--pa-accent-contrast);
}

/* 6.11.6 (owner 2026-10-30): v1's persona selector - the trigger shows the
   selection as chips; the panel beneath it holds the checkbox list. */
.personaTrigger {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius);
  background: var(--pa-surface);
  color: var(--pa-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.personaTrigger:hover { border-color: var(--pa-accent); }

.personaChip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--pa-accent);
  color: var(--pa-accent-contrast);
  font-size: 12px;
  cursor: pointer;
}

.personaChip .chipRemove { font-weight: 700; }
.personaMore { font-size: 12px; color: var(--pa-text-muted); }

.personaSelector {
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius);
  background: var(--pa-surface);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.personaSelector[hidden] { display: none; }

.selectorHead {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}

.selectorClose {
  border: 0;
  background: transparent;
  color: var(--pa-text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.selectorList {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 260px;
  overflow-y: auto;
}

.personaOption {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

/* 6.11 amendment (owner 2026-10-30): a small round portrait per row. */
.personaOption .optionPortrait {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--pa-bg);
}

.personaOption.selected {
  background: color-mix(in srgb, var(--pa-accent) 14%, transparent);
}

.conceptSpec .controls { gap: 8px; align-items: center; margin-bottom: 4px; }

#conceptResult:empty { display: none; }

.noAccessCard {
  max-width: 460px;
  margin: 18vh auto;
  text-align: center;
  background: var(--pa-surface);
  border: 1px solid var(--pa-border);
  border-radius: var(--pa-radius);
  padding: 32px;
}

/* ---- Slide-over panels (owner feedback 2026-10-26) ----------------------- */
/* Shared mechanism for the persona picker and the About panel: the chat
   header stays a pure client-customisation zone, and on-demand content
   arrives as a right-hand slide-over. */

.slideOver {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.35);
}

.slideOver[hidden] { display: none; }

.slideOverInner {
  /* Widened for the round-4 larger picker thumbnails. */
  width: min(500px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--pa-surface);
  border-left: 1px solid var(--pa-border);
  box-shadow: -4px 0 18px rgba(0, 0, 0, 0.14);
}

.slideOverHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--pa-border);
}

.personaPanelList {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px;
}

.personaEntry {
  display: flex;
  gap: 14px;
  /* Round 4: with the larger portrait, centre short text blocks against it;
     long descriptions still wrap beside the circle. */
  align-items: center;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--pa-text);
  background: var(--pa-surface);
  border: 1px solid transparent;
  border-radius: calc(var(--pa-radius) - 2px);
  padding: 8px;
  cursor: pointer;
}

/* D30: personas of segments not loaded are not listed. */
.personaEntry[hidden] { display: none; }

.personaEntry:hover {
  background: var(--pa-bg);
  border-color: var(--pa-border);
}

/* Fixed-geometry thumbnails. Round 4 (owner): doubled from 44px - the
   portraits must be legible in the picker. */
.personaEntry img {
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  object-fit: cover;
  border-radius: 50%;
  background: var(--pa-bg);
}

.personaEntry .entryName { display: block; font-weight: 600; }

.personaEntry .entryDesc {
  display: block;
  font-size: 12.5px;
  color: var(--pa-text-muted);
}

/* ---- D36 Branding page ---------------------------------------------------- */

/* Branding page previews at each slot's real display shape, with the page's
   own cover fit, so the admin sees exactly what is cropped. */
.slotPreviewBox {
  width: 100%;
  margin: 8px 0;
  border: 1px solid var(--pa-border);
  border-radius: calc(var(--pa-radius) - 4px);
  background: var(--pa-bg);
  overflow: hidden;
}

.slotPreviewBox[data-shape="banner"] {
  aspect-ratio: 8 / 1;
}

.slotPreviewBox[data-shape="square"] {
  max-width: 140px;
  aspect-ratio: 1 / 1;
}

.slotPreviewBox img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.slotForm { display: flex; gap: 8px; align-items: center; margin-top: 6px; }

.swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--pa-border);
  vertical-align: text-bottom;
  margin-right: 4px;
}

.colourRow input { max-width: 280px; }

/* ---- Auth-page product brand (round 7, 2026-10-26) ------------------------ */
/* "Personae / from Mass Cognition" - OUR mark, hardcoded in the templates,
   never client-customisable; the client's banner slot sits beneath it. */

.productBrand {
  text-align: center;
  margin-bottom: 14px;
}

.productBrand .brandWordmark {
  display: block;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--pa-text);
}

.productBrand .brandFrom {
  display: block;
  font-size: 12.5px;
  color: var(--pa-text-muted);
}
