/* Initials badge shown when an agent has no portrait. */
.avatar-fallback { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0071bc, #4d4d4d); color: #fff; font-weight: 700; letter-spacing: .02em; }

:root {
  color-scheme: light;
  --navichain-blue: #0071bc;
  --navichain-grey: #4d4d4d;
  --navy-950: #112b3b;
  --navy-900: #17384d;
  --navy-800: #214d66;
  --navy-700: #2c617b;
  --teal-500: #0071bc;
  --teal-400: #4da1d4;
  --teal-100: #e2f1fa;
  --sky-100: #edf5f9;
  --cream: #f7fafc;
  --paper: #ffffff;
  --ink: #081b2a;
  --muted: #5d6f7f;
  --line: #dce7ee;
  --shadow: 0 18px 45px rgba(17, 43, 59, 0.11);
  --radius-lg: 24px;
  --radius-md: 17px;
  --radius-sm: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

html {
  min-height: 100%;
  background: var(--cream);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    linear-gradient(rgba(0, 113, 188, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 113, 188, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 50% -18%, rgba(0, 113, 188, 0.1), transparent 37rem);
  background-size: 72px 72px, 72px 72px, auto;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(33, 184, 170, 0.35);
  outline-offset: 3px;
}

.app-shell {
  min-height: 100vh;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  font-size: 1.25rem;
  font-weight: 760;
  letter-spacing: -0.045em;
  text-decoration: none;
}

.brand-mark {
  display: block;
  width: 2.9rem;
  height: auto;
  flex: 0 0 auto;
  object-fit: contain;
}

.login-story .brand {
  padding: 0.56rem 0.78rem;
  border-radius: 0.75rem;
  color: var(--navichain-grey);
  background: rgba(255, 253, 248, 0.96);
}

.prototype-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
  padding: 0.42rem 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.prototype-pill::before {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: #ffd570;
  content: "";
}

/* Sign in */
.login-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.05fr) minmax(24rem, 0.95fr);
}

.login-story {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 4.75rem);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
}

.login-story::before,
.login-story::after {
  position: absolute;
  border: 2px solid rgba(0, 113, 188, 0.12);
  border-radius: 50%;
  content: "";
}

.login-story::before {
  right: -11rem;
  bottom: -12rem;
  width: 34rem;
  height: 34rem;
}

.login-story::after {
  right: 7rem;
  bottom: 6rem;
  width: 8rem;
  height: 8rem;
  box-shadow: 0 0 0 5rem rgba(0, 113, 188, 0.04);
}

.story-top,
.story-copy {
  position: relative;
  z-index: 1;
}

.story-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.story-copy {
  max-width: 42rem;
  padding: 5rem 0 2rem;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 1.1rem;
  color: var(--navichain-blue);
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 2.1rem;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #df9a24 0 42%, var(--navichain-blue) 42% 100%);
  content: "";
}

.story-copy h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(3.1rem, 7vw, 6.3rem);
  font-weight: 790;
  letter-spacing: -0.058em;
  line-height: 0.98;
}

.story-copy h1 span {
  color: var(--navichain-blue);
}

.story-copy p:last-child {
  max-width: 36rem;
  margin: 1.8rem 0 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.65;
}

.login-panel {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 2rem;
  border-left: 1px solid var(--line);
  background: rgba(247, 250, 252, 0.7);
}

.login-card {
  width: min(100%, 31rem);
  padding: clamp(2rem, 5vw, 3.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.login-card h2 {
  margin: 1.5rem 0 0.55rem;
  font-size: 2.05rem;
  letter-spacing: -0.045em;
}

.login-card > p {
  margin: 0 0 2rem;
  color: var(--muted);
  line-height: 1.55;
}

.field {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.field label {
  font-size: 0.9rem;
  font-weight: 680;
}

.field input {
  width: 100%;
  min-height: 3.25rem;
  padding: 0 1rem;
  border: 1px solid #cbd9dd;
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: white;
  font-size: 1rem;
}

.field input:focus {
  border-color: var(--teal-500);
}

.primary-button,
.secondary-button,
.icon-button {
  border: 0;
  cursor: pointer;
}

.primary-button {
  display: inline-flex;
  width: 100%;
  min-height: 3.35rem;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.65rem;
  border-radius: var(--radius-sm);
  color: white;
  background: var(--navichain-blue);
  font-weight: 740;
  transition: transform 160ms ease, background 160ms ease;
}

.primary-button:hover {
  background: #005f9f;
  transform: translateY(-1px);
}

.login-note {
  display: flex;
  gap: 0.55rem;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.login-note strong {
  color: var(--navy-800);
}

/* Portal */
.portal-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 5.25rem;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 0 4vw;
  border-bottom: 1px solid rgba(14, 61, 90, 0.12);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(15px);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.language-switch {
  display: inline-flex;
  gap: 0.22rem;
  padding: 0.22rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.language-switch button {
  min-width: 2.25rem;
  min-height: 2rem;
  padding: 0.25rem 0.48rem;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 760;
}

.language-switch button[aria-pressed="true"] {
  color: white;
  background: var(--navichain-blue);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.user-initial {
  display: grid;
  width: 2.3rem;
  height: 2.3rem;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--navy-900);
  font-weight: 740;
}

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #2ca66f;
  box-shadow: 0 0 0 4px rgba(44, 166, 111, 0.12);
}

.chat-composer textarea:disabled,
.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.logout-button {
  padding: 0.68rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--navy-800);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  font-weight: 650;
}

.portal-main {
  width: min(100% - 2.5rem, 92rem);
  margin: 0 auto;
  padding: clamp(2.3rem, 5vw, 4.4rem) 0 5rem;
}

.portal-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2rem;
  margin-bottom: 2.3rem;
}

.portal-intro h1 {
  max-width: 16ch;
  margin: 0;
  color: var(--navy-950);
  font-size: clamp(2.5rem, 5vw, 4.6rem);
  font-weight: 780;
  letter-spacing: -0.055em;
  line-height: 1;
}

.portal-intro p {
  max-width: 37rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.65;
}

.agent-count {
  display: grid;
  min-width: 8.5rem;
  padding: 1.1rem 1.25rem;
  border-left: 3px solid #df9a24;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.agent-count strong {
  color: var(--navy-900);
  font-size: 1.9rem;
  letter-spacing: -0.04em;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.agent-card {
  position: relative;
  display: flex;
  min-height: 23.5rem;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: inherit;
  background: var(--paper);
  box-shadow: 0 7px 22px rgba(17, 43, 59, 0.045);
  cursor: pointer;
  text-align: left;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.agent-card:hover {
  border-color: rgba(0, 113, 188, 0.65);
  box-shadow: 0 18px 38px rgba(17, 43, 59, 0.12);
  transform: translateY(-4px);
}

.agent-card::after {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  width: 2.3rem;
  height: 2.3rem;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: rgba(0, 113, 188, 0.92);
  content: "↗";
  font-size: 1rem;
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.agent-card:hover::after,
.agent-card:focus-visible::after {
  opacity: 1;
  transform: translate(0, 0);
}

.agent-portrait {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 0.92;
  overflow: hidden;
  background: #e9f0ef;
}

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

.agent-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1.15rem 1.2rem 1.3rem;
}

.agent-kicker {
  margin: 0 0 0.45rem;
  color: var(--teal-500);
  font-size: 0.75rem;
  font-weight: 780;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}

.agent-info h2 {
  margin: 0;
  color: var(--navy-950);
  font-size: 1.3rem;
  letter-spacing: -0.035em;
}

.agent-info p {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.48;
}

.chat-link {
  margin-top: auto;
  padding-top: 1rem;
  color: var(--navy-800);
  font-size: 0.88rem;
  font-weight: 730;
}

/* Desktop overview: one fixed 4 × 4 agent panel within the viewport. */
@media (min-width: 1051px) {
  .portal-main {
    display: flex;
    height: calc(100vh - 5.25rem);
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    padding: 1rem 0 1.1rem;
  }

  .portal-intro {
    flex: 0 0 auto;
    align-items: center;
    margin-bottom: 0.85rem;
  }

  .portal-intro .eyebrow {
    margin-bottom: 0.35rem;
  }

  .portal-intro h1 {
    max-width: none;
    font-size: clamp(2rem, 3vw, 2.8rem);
    line-height: 1;
  }

  .portal-intro p {
    max-width: 52rem;
    margin-top: 0.45rem;
    font-size: 0.9rem;
    line-height: 1.4;
  }

  .agent-count {
    min-width: 7.4rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.7rem;
  }

  .agent-count strong {
    font-size: 1.55rem;
  }

  .agent-grid {
    min-height: 0;
    flex: 1 1 auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .agent-card {
    min-height: 0;
    height: 100%;
    flex-direction: row;
    border-radius: 14px;
  }

  .agent-card::after {
    top: 0.6rem;
    right: 0.6rem;
    width: 1.85rem;
    height: 1.85rem;
    font-size: 0.82rem;
  }

  .agent-portrait {
    width: auto;
    height: 100%;
    flex: 0 0 37%;
    aspect-ratio: auto;
  }

  .agent-info {
    min-width: 0;
    padding: 0.62rem 0.72rem 0.68rem;
  }

  .agent-kicker {
    overflow: hidden;
    margin-bottom: 0.26rem;
    font-size: 0.75rem;
    letter-spacing: 0.065em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .agent-info h2 {
    overflow: hidden;
    font-size: clamp(0.9rem, 1.05vw, 1.08rem);
    line-height: 1.12;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .agent-info p {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 0.32rem;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 0.78rem;
    line-height: 1.3;
  }

  .chat-link {
    padding-top: 0.25rem;
    font-size: 0.75rem;
  }
}

@media (min-width: 1051px) and (max-height: 760px) {
  .portal-main {
    padding-top: 0.65rem;
    padding-bottom: 0.7rem;
  }

  .portal-intro {
    margin-bottom: 0.6rem;
  }

  .portal-intro h1 {
    font-size: 1.9rem;
  }

  .portal-intro > div > p:last-child,
  .agent-info p,
  .chat-link {
    display: none;
  }

  .agent-info {
    justify-content: center;
  }
}

/* Chat */
.chat-layout {
  display: grid;
  min-height: calc(100vh - 5.25rem);
  grid-template-columns: 19rem minmax(0, 1fr);
}

.chat-sidebar {
  padding: 2rem 1.35rem;
  border-right: 1px solid rgba(14, 61, 90, 0.12);
  background: rgba(255, 254, 250, 0.62);
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0;
  border: 0;
  color: var(--navy-700);
  background: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
}

.chat-agent-card {
  margin-top: 1.5rem;
}

.chat-avatar {
  position: relative;
  width: 8rem;
  height: 8rem;
  overflow: hidden;
  border: 5px solid white;
  border-radius: 50%;
  background: var(--sky-100);
  box-shadow: 0 12px 35px rgba(6, 30, 47, 0.14);
}

.chat-agent-card h1 {
  margin: 1.25rem 0 0.35rem;
  color: var(--navy-950);
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.chat-agent-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.availability {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  color: #267061;
  font-size: 0.84rem;
  font-weight: 670;
}

.availability::before {
  width: 0.58rem;
  height: 0.58rem;
  border-radius: 50%;
  background: var(--teal-500);
  box-shadow: 0 0 0 4px rgba(33, 184, 170, 0.12);
  content: "";
}

.chat-main {
  display: flex;
  min-width: 0;
  min-height: calc(100vh - 5.25rem);
  flex-direction: column;
}

.chat-titlebar {
  display: flex;
  min-height: 5.2rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1.2rem, 4vw, 3.2rem);
  border-bottom: 1px solid rgba(14, 61, 90, 0.1);
  background: rgba(255, 255, 255, 0.48);
}

.chat-titlebar strong {
  display: block;
  color: var(--navy-950);
  font-size: 1rem;
}

.chat-titlebar span {
  color: var(--muted);
  font-size: 0.8rem;
}

.mock-badge {
  padding: 0.38rem 0.65rem;
  border: 1px solid #e6c978;
  border-radius: 999px;
  color: #735912;
  background: #fff5d5;
  font-size: 0.76rem;
  font-weight: 720;
}

.messages {
  display: flex;
  width: min(100%, 53rem);
  flex: 1;
  flex-direction: column;
  gap: 1rem;
  margin: 0 auto;
  padding: 2.2rem 1.2rem;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 0.7rem;
}

.message-row.user {
  justify-content: flex-end;
}

.mini-avatar {
  position: relative;
  flex: 0 0 auto;
  width: 2.3rem;
  height: 2.3rem;
  overflow: hidden;
  border-radius: 50%;
  background: var(--sky-100);
}

.message {
  max-width: min(78%, 38rem);
  padding: 0.9rem 1rem;
  border-radius: 16px 16px 16px 5px;
  color: var(--ink);
  background: white;
  box-shadow: 0 5px 16px rgba(6, 30, 47, 0.07);
  line-height: 1.55;
}

.message-row.user .message {
  border-radius: 16px 16px 5px 16px;
  color: white;
  background: var(--navy-800);
}

.chat-composer-wrap {
  position: sticky;
  bottom: 0;
  padding: 0.8rem 1.2rem 1.35rem;
  background: linear-gradient(transparent, var(--cream) 32%);
}

.chat-composer {
  display: flex;
  width: min(100%, 53rem);
  align-items: flex-end;
  gap: 0.75rem;
  margin: 0 auto;
  padding: 0.68rem;
  border: 1px solid rgba(14, 61, 90, 0.14);
  border-radius: 18px;
  background: white;
  box-shadow: 0 13px 32px rgba(6, 30, 47, 0.1);
}

.chat-composer textarea {
  width: 100%;
  min-height: 3rem;
  max-height: 10rem;
  resize: vertical;
  padding: 0.75rem 0.85rem;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  line-height: 1.45;
}

.send-button {
  display: grid;
  flex: 0 0 auto;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border: 0;
  border-radius: 13px;
  color: white;
  background: var(--teal-500);
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 850;
}

.send-button:hover {
  background: #159d92;
}

.composer-note {
  width: min(100%, 53rem);
  margin: 0.55rem auto 0;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

@media (max-width: 1050px) {
  .agent-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .login-story {
    min-height: auto;
    padding: 2rem 1.5rem 3rem;
  }

  .story-copy {
    padding: 5rem 0 0;
  }

  .story-copy h1 {
    font-size: clamp(3rem, 13vw, 5rem);
  }

  .login-panel {
    min-height: auto;
    padding: 2rem 1rem 3rem;
  }

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

  .chat-layout {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1.2rem;
    border-right: 0;
    border-bottom: 1px solid rgba(14, 61, 90, 0.12);
  }

  .chat-agent-card {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.8rem;
    margin: 0;
  }

  .chat-avatar {
    width: 3.8rem;
    height: 3.8rem;
    border-width: 3px;
  }

  .chat-agent-card h1 {
    margin: 0;
    font-size: 1rem;
  }

  .chat-agent-card p,
  .availability {
    display: none;
  }

  .chat-main {
    min-height: calc(100vh - 9.5rem);
  }
}

@media (max-width: 590px) {
  .portal-header {
    min-height: 4.5rem;
    padding: 0 1rem;
  }

  .user-chip span,
  .logout-button {
    display: none;
  }

  .header-actions {
    gap: 0.5rem;
  }

  .portal-main {
    width: min(100% - 1.4rem, 92rem);
    padding-top: 2rem;
  }

  .portal-intro {
    grid-template-columns: 1fr;
  }

  .agent-count {
    min-width: 0;
  }

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

  .agent-card {
    min-height: 0;
    flex-direction: row;
  }

  .agent-portrait {
    flex: 0 0 8.2rem;
    aspect-ratio: 1;
  }

  .agent-info {
    min-width: 0;
    padding: 0.9rem;
  }

  .agent-info p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .chat-link {
    display: none;
  }

  .chat-titlebar {
    min-height: 4.2rem;
  }

  .message {
    max-width: 86%;
  }
}

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

/* PHP portal: preserve the original visual language with accessible sizing. */
a { text-decoration:none; }
.language-switch a { padding:.45rem .6rem; border-radius:7px; color:var(--muted); font-size:.78rem; font-weight:760; }
.language-switch a[aria-current] { color:white; background:var(--navichain-blue); }
.header-actions form { margin:0; }
.agent-grid { grid-auto-rows:minmax(158px,auto); }
.agent-info h2 { white-space:normal; overflow:visible; overflow-wrap:anywhere; }
.agent-info p { display:block; overflow:visible; }
.agent-info .chat-link { margin-top:auto; }
.agent-portrait .avatar-image { object-fit:contain; }
.agent-portrait { background:#edf3f5; }
.portal-main { height:auto; overflow:visible; }
.agent-grid { grid-template-rows:none; }
.agent-card { min-height:158px; }
.login-portraits { display:flex; gap:1rem; margin-top:2.5rem; }
.login-portraits img { width:clamp(65px,8vw,110px); aspect-ratio:1; border-radius:18px; box-shadow:var(--shadow); }
.error { color:#a92b2b; }
.message { white-space:pre-wrap; overflow-wrap:anywhere; }
.connection-note { display:block; margin-top:1rem; color:var(--muted); font-size:.82rem; }
.empty-chat { margin:auto; padding:3rem 1rem; text-align:center; color:var(--muted); }
button:disabled { cursor:wait; opacity:.55; }
.send-button:hover { background:#005f9f; }
.chat-main { min-width:0; }
.chat-avatar { flex-shrink:0; }
@media(min-width:1051px) { .agent-grid { grid-template-columns:repeat(4,minmax(0,1fr)); } .agent-info h2 { font-size:1rem; } .agent-info p { display:block; } .chat-link { display:block; } }
@media(min-width:1051px) and (max-width:1250px) { .agent-grid { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(max-width:590px) { .logout-button { display:block; font-size:.75rem; padding:.6rem; } .user-chip { display:none; } .portal-header .brand { font-size:1rem; gap:.4rem; } .brand-mark { width:2.2rem; } .chat-sidebar { flex-wrap:wrap; } .chat-titlebar { padding:1rem; } .message { max-width:94%; } }
@media(prefers-reduced-motion:reduce) { * { transition:none!important; scroll-behavior:auto!important; } }
.level-panel { padding:1rem clamp(1.2rem,4vw,3.2rem); background:rgba(255,255,255,.75); border-bottom:1px solid var(--line); }
.level-panel form { display:flex; align-items:center; gap:1rem; flex-wrap:wrap; }
.level-label { font-size:.85rem; font-weight:700; color:var(--navy-900); }
.level-switch { display:inline-flex; gap:4px; padding:4px; border:1px solid var(--line); border-radius:12px; background:var(--sky-100); }
.level-switch button { padding:.55rem 1rem; border:0; border-radius:8px; color:var(--navy-800); background:transparent; cursor:pointer; font-weight:700; }
.level-switch button[aria-pressed="true"] { background:var(--navichain-blue); color:white; box-shadow:0 3px 8px #0071bc20; }
.level-switch button:disabled { opacity:.45; cursor:not-allowed; }
.level-panel p { color:var(--muted); font-size:.85rem; margin:.7rem 0 .25rem; line-height:1.5; }
.level-panel small,.agent-welcome small { color:var(--muted); font-size:.75rem; }
.agent-welcome { width:min(calc(100% - 2.4rem),50.6rem); margin:1.5rem auto 0; padding:1.5rem; border:1px solid var(--line); border-radius:18px; background:rgba(255,255,255,.85); }
.agent-welcome .eyebrow { font-size:.7rem; margin-bottom:.7rem; }
.agent-welcome h2 { margin:0; color:var(--navy-950); font-size:1.55rem; letter-spacing:-.03em; }
.agent-welcome p { color:var(--muted); line-height:1.6; font-size:.94rem; }
.agent-welcome summary { cursor:pointer; color:var(--navy-800); font-size:.9rem; font-weight:700; }
.agent-welcome h3 { font-size:.9rem; margin-top:1.25rem; }
.starter-list { display:flex; flex-wrap:wrap; gap:.5rem; margin-bottom:.7rem; }
.starter { display:inline-flex; justify-content:space-between; gap:.6rem; text-align:left; padding:.7rem .85rem; border:1px solid #cbdfe9; border-radius:10px; color:var(--navy-800); background:#f3f8fb; cursor:pointer; font-size:.82rem; line-height:1.4; }
.starter:hover { border-color:var(--navichain-blue); background:#e2f1fa; }
.messages .empty-chat { padding:1rem; }
.story-copy>p:not(.eyebrow) { max-width:36rem; color:var(--muted); line-height:1.65; }

/* Agent answers rendered from Markdown (assets/markdown.js) */
.message.md { white-space: normal; }
.message.md > :first-child { margin-top: 0; }
.message.md > :last-child { margin-bottom: 0; }
.message.md p, .message.md ul, .message.md ol, .message.md blockquote, .message.md pre, .message.md .md-table { margin: 0 0 0.75rem; }
.message.md h3, .message.md h4, .message.md h5, .message.md h6 { margin: 1.1rem 0 0.45rem; line-height: 1.3; color: var(--ink); }
.message.md .md-h1 { font-size: 1.2rem; }
.message.md .md-h2 { font-size: 1.1rem; }
.message.md .md-h3 { font-size: 1.02rem; }
.message.md .md-h4, .message.md .md-h5, .message.md .md-h6 { font-size: 0.95rem; }
.message.md ul, .message.md ol { padding-left: 1.35rem; }
.message.md li { margin: 0.2rem 0; }
.message.md li > ul, .message.md li > ol { margin: 0.2rem 0 0.3rem; }
.message.md hr { margin: 1rem 0; border: 0; border-top: 1px solid var(--line); }
.message.md blockquote { padding: 0.5rem 0.85rem; border-left: 3px solid var(--navichain-blue); border-radius: 0 8px 8px 0; color: var(--muted); background: var(--cream); }
.message.md code { padding: 0.1rem 0.3rem; border-radius: 5px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86em; background: var(--cream); border: 1px solid var(--line); }
.message.md pre { overflow-x: auto; padding: 0.75rem 0.9rem; border-radius: 10px; background: #0d2233; }
.message.md pre code { padding: 0; border: 0; color: #e6f0f6; background: none; font-size: 0.84rem; white-space: pre; }
.message.md a { color: var(--navichain-blue); text-decoration: underline; overflow-wrap: anywhere; }
.message.md .md-table { overflow-x: auto; max-width: 100%; }
.message.md table { border-collapse: collapse; font-size: 0.88rem; min-width: 100%; }
.message.md th, .message.md td { padding: 0.45rem 0.6rem; border: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: normal; word-break: normal; }
.message.md th { background: var(--cream); font-weight: 700; }
.message.md tbody tr:nth-child(even) td { background: #fbfdfe; }

/* Saved conversations: agent sidebar list and My conversations page */
.recent-convs { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.recent-convs h2 { margin: 0 0 .5rem; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.recent-convs ul { margin: 0; padding: 0; list-style: none; }
.recent-convs li a { display: block; padding: .45rem .55rem; border-radius: 10px; color: var(--ink); font-size: .88rem; line-height: 1.3; text-decoration: none; overflow-wrap: anywhere; }
.recent-convs li a:hover, .recent-convs li a[aria-current="true"] { background: var(--cream); }
.recent-convs li a[aria-current="true"] { font-weight: 700; }
.recent-convs small { display: block; margin-top: .15rem; color: var(--muted); font-size: .74rem; font-weight: 400; }
.recent-convs .all-convs { display: inline-block; margin-top: .6rem; color: var(--navichain-blue); font-size: .85rem; }
.muted-note { color: var(--muted); font-size: .88rem; }
.history-search input[type="search"] { min-width: min(100%, 22rem); }
.conv-list { margin: 0; padding: 0; list-style: none; display: grid; gap: .75rem; }
.conv-item { padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); }
.conv-head { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: baseline; justify-content: space-between; }
.conv-title { color: var(--ink); font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.conv-title:hover { color: var(--navichain-blue); text-decoration: underline; }
.conv-meta { color: var(--muted); font-size: .8rem; }
.conv-excerpt { margin: .5rem 0 0; color: var(--navichain-grey); font-size: .9rem; overflow-wrap: anywhere; }
.conv-actions { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin-top: .7rem; }
.conv-rename summary { cursor: pointer; color: var(--navichain-blue); font-size: .85rem; }
.conv-rename form { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.conv-rename input { flex: 1 1 14rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.inline-form { display: inline; margin: 0; }
.text-button { padding: 0; border: 0; background: none; color: var(--navichain-blue); font: inherit; font-size: .85rem; cursor: pointer; }
.history-actions { margin: .5rem 0 1rem; }
.history-messages { padding: 1rem 0; }
.message-meta { display: block; margin-top: .25rem; color: var(--muted); font-size: .72rem; }
.message-row.user .message-meta { text-align: right; }
.history-messages .message-row { flex-direction: column; align-items: flex-start; }
.history-messages .message-row.user { align-items: flex-end; }
.message-row.highlight .message { outline: 3px solid var(--navichain-blue); outline-offset: 2px; }

/* Header: keep every button visible now that it has more of them */
.header-actions { min-width: 0; flex-wrap: wrap; justify-content: flex-end; row-gap: .4rem; }
.header-actions .logout-button, .header-actions .user-chip { white-space: nowrap; }
@media (max-width: 1400px) {
  .portal-header { padding: 0 2vw; }
  .header-actions { gap: .5rem; }
  .header-actions .logout-button { padding: .55rem .7rem; font-size: .88rem; }
}

/* Sidebar conversation list: groups, filter and ⋯ menu */
.new-chat-button { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .85rem; border: 1px solid rgba(0, 113, 188, .35); border-radius: 999px; background: rgba(0, 113, 188, .08); color: var(--navichain-blue); font: inherit; font-size: .84rem; font-weight: 700; white-space: nowrap; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.new-chat-button span { font-size: 1.05rem; line-height: 1; }
.conv-menu-panel .small-button { padding: .35rem .8rem; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.conv-menu-panel .small-button:hover { border-color: var(--navichain-blue); color: var(--navichain-blue); }
.new-chat-button:hover, .new-chat-button:focus-visible { border-color: var(--navichain-blue); background: var(--navichain-blue); color: #fff; }
.new-chat-button:focus-visible { outline: 3px solid rgba(0, 113, 188, .3); outline-offset: 2px; }
.new-chat-button:disabled { opacity: .5; cursor: not-allowed; }
.recent-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.recent-head h2 { margin: 0; }
.conv-filter { width: 100%; margin: 0 0 .5rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .85rem; background: var(--paper); }
.conv-group h3 { margin: .7rem 0 .2rem; padding: 0 .55rem; color: var(--muted); font-size: .72rem; font-weight: 600; }
.conv-entry { position: relative; display: flex; align-items: center; gap: .2rem; }
.conv-entry > a { flex: 1; min-width: 0; }
.recent-convs .conv-entry > a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-menu > summary { list-style: none; cursor: pointer; padding: .2rem .45rem; border-radius: 6px; color: var(--muted); line-height: 1; }
.conv-menu > summary::-webkit-details-marker { display: none; }
.conv-menu > summary:hover, .conv-menu[open] > summary { background: var(--cream); color: var(--ink); }
.conv-menu-panel { position: absolute; right: 0; top: 100%; z-index: 20; display: grid; gap: .45rem; justify-items: start; min-width: 13rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: var(--shadow); }
.conv-menu-panel .conv-rename form { flex-direction: column; }
.danger-text { color: #9b1c1c; }
a.text-button { text-decoration: none; }
@media (max-width: 900px) { .recent-convs { max-height: 45vh; overflow-y: auto; } }

/* Background answers: waiting bubble, handoff note, badge, new-answers list */
.message.waiting { color: var(--muted); font-style: italic; }
.message.waiting::after { content: ' ⋯'; animation: waiting-pulse 1.4s ease-in-out infinite; }
@keyframes waiting-pulse { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .message.waiting::after { animation: none; } }
.handoff { flex-basis: 100%; max-width: min(78%, 38rem); margin-top: .5rem; padding: .7rem .9rem; border: 1px dashed var(--line); border-radius: 12px; background: var(--paper); font-size: .88rem; }
.handoff p { margin: 0 0 .5rem; color: var(--navichain-grey); }
.cancel-job { flex-basis: 100%; margin-top: .3rem; text-align: left; font-size: .8rem; }
.ready-badge { display: inline-block; min-width: 1.3rem; margin-left: .4rem; padding: .05rem .35rem; border-radius: 999px; background: var(--navichain-blue); color: #fff; font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.3; }
.ready-badge[hidden] { display: none; }
.ready-list { margin: 0 0 1.2rem; padding: .9rem 1.1rem; border: 1px solid var(--line); border-left: 4px solid var(--navichain-blue); border-radius: var(--radius-sm); background: var(--paper); }
.ready-list h2 { margin: 0 0 .5rem; font-size: 1rem; }
.ready-list ul { margin: 0; padding-left: 1.1rem; }
.ready-list li { margin: .25rem 0; }

/* Tools under each message */
.message-row { flex-wrap: wrap; }
.msg-tools { display: flex; gap: .15rem; flex-basis: 100%; margin-top: .2rem; opacity: .55; transition: opacity .15s; }
.message-row.user .msg-tools { justify-content: flex-end; }
.message-row:hover .msg-tools, .msg-tools:focus-within { opacity: 1; }
.msg-tool { padding: .2rem .4rem; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: .85rem; line-height: 1.2; cursor: pointer; }
.msg-tool:hover, .msg-tool[aria-pressed="true"] { background: var(--cream); color: var(--ink); }
.message.md pre.has-copy { position: relative; }
.message.md .code-copy { position: absolute; top: .4rem; right: .4rem; padding: .15rem .45rem; border: 1px solid rgba(255,255,255,.25); border-radius: 6px; background: rgba(255,255,255,.08); color: #e6f0f6; font-size: .72rem; opacity: .8; }
@media (hover: none) { .msg-tools { opacity: 1; } }

/* Chat attachments: attach button, chips above the composer, files under a sent message, drop highlight */
.attach-button { flex: 0 0 auto; align-self: flex-end; width: 2.6rem; height: 2.6rem; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); font-size: 1.15rem; cursor: pointer; transition: border-color .15s, background .15s; }
.attach-button:hover, .attach-button:focus-visible { border-color: var(--navichain-blue); background: rgba(0, 113, 188, .08); }
.attach-button:disabled { opacity: .5; cursor: not-allowed; }
.attachment-list { display: flex; flex-wrap: wrap; gap: .4rem; width: min(100%, 52rem); margin: 0 auto .5rem; }
.attachment-list:empty { display: none; }
.file-chip { display: inline-flex; align-items: center; gap: .45rem; max-width: 100%; padding: .3rem .6rem; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font-size: .82rem; overflow-wrap: anywhere; }
.file-chip small { color: var(--muted); font-size: .74rem; }
.file-chip.uploading { border-style: dashed; }
.file-chip.error { border-color: #f3c1bd; background: #fff5f4; }
.file-chip.error small { color: #9b1c1c; }
.file-chip-remove { padding: 0 .2rem; border: 0; background: none; color: var(--muted); font-size: 1rem; line-height: 1; cursor: pointer; }
.file-chip-remove:hover, .file-chip-remove:focus-visible { color: #9b1c1c; }
.msg-files { display: flex; flex-wrap: wrap; gap: .3rem; flex-basis: 100%; margin-top: .3rem; }
.message-row.user .msg-files { justify-content: flex-end; }
.chat-composer-wrap.drop-target .chat-composer { outline: 3px dashed var(--navichain-blue); outline-offset: 3px; background: rgba(0, 113, 188, .05); }
