/*
  PhotoFolio Support Manual custom layer

  Edit this file first when shaping the lab/manual UI. It loads after
  manual.css, so these rules override the bundled baseline without making
  the main stylesheet harder to maintain.
*/

:root {
  --custom-bg: #ededed;
  --custom-paper: #f6f6f6;
  --custom-panel: #f2f2f2;
  --custom-ink: #222222;
  --custom-copy: #222222;
  --custom-muted: #737373;
  --custom-line: #d6d6d6;
  --custom-accent: #00d9ff;
  --custom-accent-soft: rgba(0, 217, 255, 0.1);
  --custom-accent-line: rgba(0, 217, 255, 0.42);
  --custom-warm: #00a9c7;
  --custom-sidebar-width: 320px;
  --custom-chat-width: 920px;
  --custom-radius: 8px;
}

html,
body {
  background: var(--custom-bg);
  color: var(--custom-copy);
}

body,
button,
input,
textarea,
select {
  letter-spacing: 0;
}

.app {
  grid-template-columns: var(--custom-sidebar-width) minmax(0, 1fr);
  background: var(--custom-bg);
}

.panel,
.sidebar,
.ai-panel,
.chat-shell,
.welcome-home,
.template-card {
  background: var(--custom-panel);
  border-color: var(--custom-line);
  border-radius: var(--custom-radius);
  color: var(--custom-copy);
}

.sidebar,
.ai-panel {
  border-radius: 0;
}

.brand,
.chat-title,
.welcome-home-title,
.article-title,
.prose h2,
.prose h3 {
  color: var(--custom-ink);
}

.subtitle,
.main-top-label,
.chat-scope,
.chat-side-note,
.welcome-home-lead,
.welcome-home-card-desc,
.prose p,
.prose li {
  color: var(--custom-muted);
}

.tab.active,
.btn-neon {
  background: var(--custom-ink);
  border-color: var(--custom-ink);
  color: #fff;
  box-shadow: none;
  text-shadow: none;
}

.btn-neon:hover:not(:disabled) {
  background: var(--custom-accent);
  border-color: var(--custom-accent);
  color: #fff;
  box-shadow: none;
  transform: translateY(-1px);
}

.nav-link.active,
.nav-link.active.guide,
.nav-link.active.hub {
  background: var(--custom-accent-soft);
  border-color: var(--custom-accent-line);
  color: var(--custom-ink);
}

/* Home chat layout */
body.is-chat-home .manual-home {
  align-items: stretch;
  gap: 1rem;
  max-width: var(--custom-chat-width);
  margin-inline: auto;
}

body.is-chat-home .chat-home-slot {
  width: 100%;
}

body.is-chat-home .chat-root--home .chat-shell {
  min-height: min(72vh, 760px);
  border-color: var(--custom-line);
  box-shadow: 0 18px 48px rgba(36, 31, 25, 0.08);
  overflow: hidden;
}

body.is-chat-home .chat-root--home .chat-head {
  padding: 1rem 1.15rem;
  background: var(--custom-paper);
  border-bottom-color: var(--custom-line);
}

.chat-eyebrow {
  color: var(--custom-warm);
  text-shadow: none;
}

body.is-chat-home .chat-root--home .chat-title {
  font-size: 1.25rem;
  color: var(--custom-ink);
  letter-spacing: 0;
}

body.is-chat-home .chat-root--home .chat-eyebrow,
body.is-chat-home .chat-root--home .rail-label {
  color: var(--custom-warm);
  text-shadow: none;
}

body.is-chat-home .chat-root--home .chat-log {
  min-height: 320px;
  max-height: 46vh;
  padding: 1.1rem;
  background: linear-gradient(180deg, #fffdf8 0%, #faf7ef 100%);
}

.chat-bubble {
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.55;
}

body.is-chat-home .chat-root--home .chat-bubble {
  max-width: min(78%, 680px);
}

.chat-bubble--assistant {
  background: #fff;
  border-color: var(--custom-line);
  color: var(--custom-copy);
  box-shadow: 0 8px 22px rgba(36, 31, 25, 0.06);
}

.chat-bubble--user {
  background: var(--custom-ink);
  border-color: var(--custom-ink);
  color: #fff;
}

.chat-bubble--assistant .chat-answer-title {
  color: var(--custom-ink);
  letter-spacing: 0;
}

.chat-inline-link,
.prose a,
.welcome-home-foot a {
  color: var(--custom-accent);
}

.chat-thinking {
  max-width: min(100%, 300px);
}

.chat-think-panel {
  background: rgba(0, 207, 255, 0.06);
  border: 1px solid rgba(0, 207, 255, 0.35);
  box-shadow: 0 0 0 1px rgba(0, 207, 255, 0.08), 0 8px 24px rgba(0, 120, 200, 0.08);
  color: var(--custom-copy);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.28rem;
  min-width: 0;
  border-radius: 10px;
  padding: 0.34rem 0.42rem;
  animation: chat-think-panel-in 0.28s ease-out;
}

@keyframes chat-think-panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-think-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.chat-think-panel--has-steps .chat-think-sub {
  color: var(--pf-chat-neon, #00cfff);
}

.chat-think-sub {
  color: #00cfff;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.58rem;
  letter-spacing: 0.02em;
}

.chat-think-steps {
  list-style: none;
  margin: 0;
  padding: 0.1rem 0 0;
  display: grid;
  gap: 0.22rem;
  font-size: 0.56rem;
  line-height: 1.28;
  color: rgba(0, 180, 230, 0.85);
  border-top: 1px solid rgba(0, 207, 255, 0.18);
}

.chat-think-panel:not(.chat-think-panel--has-steps) .chat-think-steps {
  display: none;
  padding: 0;
  border-top: 0;
}

.chat-think-step {
  display: grid;
  grid-template-columns: 0.82rem minmax(0, 1fr);
  gap: 0.32rem;
  align-items: start;
  min-width: 0;
  animation: chat-think-step-in 0.24s ease-out;
}

@keyframes chat-think-step-in {
  from { opacity: 0; transform: translateX(-3px); }
  to { opacity: 1; transform: translateX(0); }
}

.chat-think-step-copy {
  min-width: 0;
}

.chat-think-step-icon {
  width: 0.82rem;
  text-align: center;
  color: #00cfff;
  flex-shrink: 0;
  line-height: 1.28;
  font-size: 0.58rem;
}

.chat-think-spin {
  display: inline-block;
  width: 0.62rem;
  height: 0.62rem;
  border: 1.5px solid rgba(0, 207, 255, 0.22);
  border-top-color: #00cfff;
  border-radius: 50%;
  animation: chat-think-spin 0.75s linear infinite;
  vertical-align: -0.05rem;
}

.chat-think-pulse-dot {
  display: inline-block;
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: #00cfff;
  animation: chat-think-pulse 1s ease-in-out infinite;
  vertical-align: 0.05rem;
}

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

.chat-think-step.is-running .chat-think-step-icon {
  animation: chat-think-pulse 1.1s ease-in-out infinite;
}

.chat-think-step.is-done .chat-think-step-icon {
  color: #2f855a;
}

.chat-think-step-label {
  display: block;
  color: rgba(220, 245, 255, 0.92);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.56rem;
}

.chat-think-step-meta {
  margin-top: 0.04rem;
  color: rgba(0, 207, 255, 0.72);
  font-size: 0.5rem;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  word-break: break-word;
}

.chat-think-step.is-reasoning .chat-think-step-label {
  font-style: italic;
  opacity: 0.92;
}

.chat-think-step.is-subagent .chat-think-step-label {
  color: #5ee7ff;
}

.chat-think-step.is-subagent.is-running {
  background: rgba(0, 207, 255, 0.06);
  border-radius: 6px;
  padding: 0.08rem 0.12rem 0.08rem 0;
}

.chat-think-step.is-subagent.is-running .chat-think-step-icon {
  animation: chat-think-pulse 1.2s ease-in-out infinite;
}

.chat-think-step-tool {
  display: inline-block;
  margin-right: 0.25rem;
  padding: 0.04rem 0.28rem;
  border-radius: 999px;
  border: 1px solid var(--custom-line);
  font-size: 0.58rem;
  letter-spacing: 0.01em;
  color: var(--custom-muted);
  vertical-align: baseline;
}

.chat-viewfinder-corner,
.chat-shutter-dot,
.chat-cursor,
.chat-bubble--typing .chat-cursor-inline {
  border-color: var(--custom-accent);
  background: var(--custom-accent);
  box-shadow: none;
}

.chat-focus-ring {
  border-color: var(--custom-accent-line);
}

@keyframes chat-think-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.chat-agent-trace {
  display: inline-block;
  width: fit-content;
  max-width: min(420px, 100%);
  margin: 0.28rem 0 0.42rem;
  border: 1px solid var(--custom-line);
  border-radius: 999px;
  background: var(--custom-panel);
  color: var(--custom-muted);
  font-size: 0.68rem;
  line-height: 1.25;
}

.chat-agent-trace-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  cursor: pointer;
  padding: 0.18rem 0.46rem;
  list-style: none;
  color: var(--custom-copy);
  font-weight: 600;
  white-space: nowrap;
}

.chat-agent-trace-toggle::-webkit-details-marker {
  display: none;
}

.chat-agent-trace-count {
  display: inline-grid;
  place-items: center;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.22rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--custom-accent) 16%, var(--custom-panel));
  color: var(--custom-accent);
  font-size: 0.56rem;
  font-weight: 700;
  line-height: 1;
}

.chat-agent-trace-body {
  margin: 0.34rem 0 0.12rem;
  padding: 0.42rem 0.48rem 0.46rem;
  border: 1px solid var(--custom-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--custom-panel) 94%, #000 6%);
}

.chat-agent-trace-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.34rem;
}

.chat-agent-trace-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.34rem;
  align-items: start;
}

.chat-agent-trace-icon {
  width: 0.92rem;
  height: 0.92rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
}

.chat-agent-trace-item--ok .chat-agent-trace-icon {
  background: color-mix(in srgb, #3ecf8e 18%, var(--custom-panel));
  color: #3ecf8e;
}

.chat-agent-trace-item--warn .chat-agent-trace-icon {
  background: color-mix(in srgb, #ffb020 18%, var(--custom-panel));
  color: #ffb020;
}

.chat-agent-trace-copy {
  display: grid;
  gap: 0.08rem;
  min-width: 0;
}

.chat-agent-trace-item-label {
  color: var(--custom-copy);
  font-weight: 600;
}

.chat-agent-trace-item-detail {
  color: var(--custom-muted);
  font-size: 0.62rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.chat-compose {
  background: transparent;
}

body.is-chat-home .chat-root--home .chat-compose {
  padding: 0.85rem 1.1rem 1rem;
  border-top: 0;
  background: transparent;
}

body.is-chat-home .chat-root--home .chat-compose-quick,
body.is-chat-home .chat-root--home .chat-side-note,
body.is-chat-home .chat-root--home .chat-sources {
  background: #fff;
}

.chat-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  border-top-color: var(--custom-line);
  background: transparent;
}

.chat-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 3rem;
  max-height: 10rem;
  resize: vertical;
  padding: 0.78rem 0.9rem;
  border: 1px solid var(--custom-line);
  border-radius: 8px;
  background: var(--custom-paper);
  color: var(--custom-ink);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.45;
}

.chat-form textarea:focus {
  outline: none;
  border-color: var(--custom-accent);
  box-shadow: 0 0 0 3px var(--custom-accent-soft);
}

.chat-quick {
  flex-direction: row;
  flex-wrap: wrap;
}

.chat-chip,
.chat-source {
  background: var(--custom-paper);
  border-color: var(--custom-line);
  color: var(--custom-copy);
  text-shadow: none;
  box-shadow: none;
}

.chat-chip:hover,
.chat-source:hover {
  background: var(--custom-accent-soft);
  border-color: var(--custom-accent-line);
  color: var(--custom-ink);
}

.chat-close {
  background: transparent;
  border-color: var(--custom-line);
  color: var(--custom-ink);
}

.ai-fab {
  left: calc(var(--custom-sidebar-width) + 1.25rem);
}

.welcome-home {
  box-shadow: none;
}

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

  body.is-chat-home .chat-root--home .chat-shell {
    min-height: 68vh;
  }

  body.is-chat-home .chat-root--home .chat-bubble {
    max-width: 92%;
  }

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

  .chat-form button[type="submit"] {
    width: 100%;
  }

  .ai-fab {
    left: 1rem;
  }
}

/* Annotation pass: fullscreen support-agent chat */
body.is-chat-home .main {
  background: #000;
}

body.is-chat-home .content {
  width: 100%;
  max-width: none;
  height: 100vh;
  padding: clamp(1rem, 2vw, 2rem);
  display: flex;
  overflow: hidden;
}

body.is-chat-home .manual-home {
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  gap: 0;
}

body.is-chat-home .chat-home-slot,
body.is-chat-home .chat-root--home,
body.is-chat-home .chat-root--home .chat-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
}

body.is-chat-home .chat-root--home .chat-shell {
  border: 1px solid rgba(0, 229, 255, 0.42);
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(0, 229, 255, 0.12), transparent 34rem),
    #fffdf8;
  box-shadow:
    0 0 0 1px rgba(0, 229, 255, 0.08),
    0 0 44px rgba(0, 229, 255, 0.18);
}

body.is-chat-home .chat-root--home .chat-log {
  max-height: none;
  min-height: 0;
}

body.is-chat-home .chat-root--home .chat-compose-quick {
  display: none;
}

body.is-chat-home .chat-root--home .chat-compose {
  padding: 0.85rem 1.1rem 1rem;
  border-top: 0;
  background: transparent;
  background-image: none;
  box-shadow: none;
}

body.is-chat-home .chat-root--home .chat-form {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto;
  align-items: stretch;
  gap: 0.65rem;
  padding: 0;
  border: 1px solid rgba(0, 229, 255, 0.62);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(0, 229, 255, 0.1), rgba(0, 0, 0, 0.04)),
    rgba(1, 12, 15, 0.96);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 26px rgba(0, 229, 255, 0.18);
}

body.is-chat-home .chat-root--home .chat-form::before {
  content: ">";
  align-self: start;
  grid-column: 1;
  grid-row: 1;
  padding: 1rem 0 0 1rem;
  color: #00e5ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 1rem;
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.75);
}

body.is-chat-home .chat-root--home .chat-form textarea {
  grid-column: 2;
  grid-row: 1;
  min-height: 4.5rem;
  padding: 1rem 0.2rem 0.95rem 0;
  border: 0;
  border-radius: 0;
  resize: none;
  background: transparent;
  color: #d9fbff;
  caret-color: #00e5ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

body.is-chat-home .chat-root--home .chat-form textarea::placeholder {
  color: rgba(217, 251, 255, 0.52);
}

body.is-chat-home .chat-root--home .chat-form textarea:focus {
  box-shadow: none;
}

body.is-chat-home .chat-root--home .chat-form button[type="submit"] {
  grid-column: 3;
  grid-row: 1;
  align-self: stretch;
  margin: 0.5rem;
  min-width: 6.5rem;
  border-color: rgba(0, 229, 255, 0.48);
  background: rgba(0, 229, 255, 0.12);
  color: #eaffff;
}

body.is-chat-home .chat-root--home .chat-form button[type="submit"]:hover:not(:disabled) {
  background: rgba(0, 229, 255, 0.22);
  border-color: rgba(0, 229, 255, 0.78);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.22);
}

body.is-chat-home .chat-root--home .chat-side-note {
  display: none;
}

/* Annotation pass: cleaner sidebar disclosure arrows */
.nav-tree {
  background: #151515;
}

.nav-section-title {
  background: #f6f3eb;
  border-bottom: 1px solid var(--custom-line);
  color: #544f48;
}

.nav-section {
  background: #151515;
}

.nav-folder summary {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.55rem;
  color: rgba(255, 255, 255, 0.84);
}

.nav-folder summary::before {
  content: "";
  width: 0.82rem;
  height: 0.82rem;
  border: 1px solid rgba(0, 229, 255, 0.52);
  border-radius: 3px;
  background:
    linear-gradient(135deg, transparent 48%, #00e5ff 49% 58%, transparent 59%) center / 0.42rem 0.42rem no-repeat,
    rgba(0, 229, 255, 0.08);
  justify-self: center;
  transition: transform 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.nav-folder[open] summary::before {
  content: "";
  transform: rotate(90deg);
  border-color: rgba(0, 229, 255, 0.82);
  background:
    linear-gradient(135deg, transparent 48%, #00e5ff 49% 58%, transparent 59%) center / 0.42rem 0.42rem no-repeat,
    rgba(0, 229, 255, 0.18);
}

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

.folder-count {
  align-self: center;
  justify-self: end;
  margin-left: 0;
}

@media (max-width: 900px) {
  body.is-chat-home .content {
    height: auto;
    min-height: 100vh;
    padding: 0.85rem;
  }

  body.is-chat-home .chat-root--home .chat-shell {
    min-height: calc(100vh - 1.7rem);
  }

  body.is-chat-home .chat-root--home .chat-form {
    grid-template-columns: auto 1fr;
  }

  body.is-chat-home .chat-root--home .chat-form button[type="submit"] {
    grid-column: 1 / -1;
    width: calc(100% - 1rem);
  }
}

/* Annotation pass: cohesive themes + composer tools */
:root {
  --pf-chat-stage: #e7e7e7;
  --pf-chat-surface: #f4f4f4;
  --pf-chat-surface-soft: #e9e9e9;
  --pf-chat-ink: #222222;
  --pf-chat-muted: #727272;
  --pf-chat-line: #d4d4d4;
  --pf-chat-neon: #0099ff;
  --pf-chat-neon-strong: #33adff;
  --pf-chat-neon-soft: rgba(0, 153, 255, 0.14);
  --pf-chat-panel: rgba(2, 12, 15, 0.94);
  --pf-chat-panel-2: rgba(8, 30, 36, 0.92);
}

:root[data-manual-theme="dark"] {
  --custom-bg: #111111;
  --custom-paper: #1a1a1a;
  --custom-panel: #2d2d2d;
  --custom-ink: #eeeeee;
  --custom-copy: #e6e6e6;
  --custom-muted: #999999;
  --custom-line: #3a3a3a;
  --custom-accent: #0099ff;
  --custom-accent-soft: rgba(0, 153, 255, 0.12);
  --custom-accent-line: rgba(0, 153, 255, 0.42);
  --custom-warm: #0099ff;
  --custom-radius: 6px;
  --pf-chat-stage: #111111;
  --pf-chat-surface: #222222;
  --pf-chat-surface-soft: #1a1a1a;
  --pf-chat-ink: #e6e6e6;
  --pf-chat-muted: #999999;
  --pf-chat-line: #3a3a3a;
  --pf-chat-panel: rgba(17, 17, 17, 0.98);
  --pf-chat-panel-2: rgba(34, 34, 34, 0.96);
  --pf-chat-neon: #0099ff;
  --pf-chat-neon-strong: #33adff;
  --pf-chat-neon-soft: rgba(0, 153, 255, 0.14);
}

body.is-chat-home .main {
  background: var(--pf-chat-stage);
}

body.is-chat-home .chat-root--home .chat-shell {
  border-color: rgba(0, 217, 255, 0.42);
  background:
    radial-gradient(circle at 50% 0%, rgba(0, 217, 255, 0.1), transparent 34rem),
    var(--pf-chat-surface);
  box-shadow:
    0 0 0 1px rgba(0, 217, 255, 0.08),
    0 0 44px rgba(0, 217, 255, 0.18);
  color: var(--pf-chat-ink);
}

body.is-chat-home .chat-root--home .chat-head {
  background: color-mix(in srgb, var(--pf-chat-surface) 90%, var(--pf-chat-neon) 10%);
  border-bottom-color: var(--pf-chat-line);
}

body.is-chat-home .chat-root--home .chat-title {
  color: var(--pf-chat-ink);
}

body.is-chat-home .chat-root--home .chat-eyebrow {
  color: var(--custom-warm);
}

body.is-chat-home .chat-root--home .chat-log {
  background: linear-gradient(180deg, var(--pf-chat-surface) 0%, var(--pf-chat-surface-soft) 100%);
}

body.is-chat-home .chat-root--home .chat-head-actions {
  display: flex;
  padding-right: 3rem;
}

body.is-chat-home .chat-root--home .chat-close {
  display: none;
}

body.is-chat-home .chat-root--home .chat-new {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  min-width: 1.7rem;
  height: 1.7rem;
  margin-right: 0.35rem;
  padding: 0;
  border: 1px solid rgba(0, 217, 255, 0.45);
  border-radius: 5px;
  background: transparent;
  color: var(--pf-chat-neon-strong);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

body.is-chat-home .chat-root--home .chat-new:hover {
  background: rgba(0, 217, 255, 0.08);
}

.chat-theme-toggle {
  position: relative;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 1px solid rgba(0, 217, 255, 0.5);
  border-radius: 999px;
  color: var(--pf-chat-neon-strong);
  background: rgba(0, 217, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.chat-theme-toggle:hover {
  border-color: rgba(0, 217, 255, 0.86);
  background: rgba(0, 217, 255, 0.16);
  box-shadow: 0 0 22px rgba(0, 217, 255, 0.2);
}

.chat-theme-toggle-icon {
  position: absolute;
  inset: 0.48rem;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 12px rgba(0, 217, 255, 0.5);
}

:root[data-manual-theme="dark"] .chat-theme-toggle-icon {
  background: transparent;
  box-shadow: inset 0.35rem 0 0 currentColor;
}

body.is-chat-home .chat-root--home .chat-compose {
  border-top-color: rgba(0, 217, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(0, 217, 255, 0.1), rgba(0, 0, 0, 0.88) 30%),
    var(--pf-chat-panel);
  box-shadow: 0 -18px 40px rgba(0, 217, 255, 0.12);
}

body.is-chat-home .chat-root--home .chat-form {
  grid-template-columns: auto auto auto minmax(0, 1fr) auto;
  grid-template-rows: auto;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem;
  border-color: rgba(0, 217, 255, 0.62);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(0, 217, 255, 0.11), rgba(0, 0, 0, 0.03)),
    var(--pf-chat-panel);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 26px rgba(0, 217, 255, 0.18);
}

body.is-chat-home .chat-root--home .chat-form::before {
  content: "";
  grid-column: 1;
  grid-row: 1;
  width: 2px;
  height: 1.55rem;
  margin: 0 0.15rem 0 0.35rem;
  padding: 0 !important;
  border: 0;
  background: var(--pf-chat-neon);
  transform: none;
  box-shadow: 0 0 14px rgba(0, 217, 255, 0.8);
}

body.is-chat-home .chat-root--home .chat-tool,
body.is-chat-home .chat-root--home .chat-send-icon {
  position: relative;
  display: block;
  appearance: none;
  width: 2.6rem;
  min-width: 2.6rem;
  height: 2.6rem;
  border: 1px solid rgba(0, 217, 255, 0.5);
  border-radius: 999px;
  color: var(--pf-chat-neon-strong);
  background: rgba(0, 217, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

body.is-chat-home .chat-root--home .chat-tool:hover,
body.is-chat-home .chat-root--home .chat-send-icon:hover {
  border-color: rgba(0, 217, 255, 0.86);
  background: rgba(0, 217, 255, 0.16);
  box-shadow: 0 0 22px rgba(0, 217, 255, 0.2);
}

body.is-chat-home .chat-root--home .chat-tool--upload {
  grid-column: 2 !important;
  grid-row: 1 !important;
}

body.is-chat-home .chat-root--home .chat-tool--upload::before,
body.is-chat-home .chat-root--home .chat-tool--upload::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

body.is-chat-home .chat-root--home .chat-tool--upload::before {
  top: 0.68rem;
  width: 0.78rem;
  height: 0.58rem;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 0.18rem 0.18rem 0 0;
}

body.is-chat-home .chat-root--home .chat-tool--upload::after {
  bottom: 0.7rem;
  width: 1rem;
  height: 0.62rem;
  border: 2px solid currentColor;
  border-radius: 0.16rem;
}

body.is-chat-home .chat-root--home .chat-tool--target {
  grid-column: 3 !important;
  grid-row: 1 !important;
}

body.is-chat-home .chat-root--home .chat-tool--target::before {
  content: "";
  position: absolute;
  inset: 0.72rem;
  border: 2px solid currentColor;
  border-radius: 999px;
  box-shadow:
    0 0 0 5px rgba(0, 217, 255, 0.08),
    0 0 14px rgba(0, 217, 255, 0.28);
}

body.is-chat-home .chat-root--home .chat-tool--target::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0.48rem;
  width: 1px;
  height: 1.65rem;
  background: currentColor;
  transform: translateX(-50%);
  box-shadow: 0.82rem 0 0 currentColor, -0.82rem 0 0 currentColor;
  opacity: 0.75;
}

body.is-chat-home .chat-root--home .chat-tool--target.is-active {
  background: rgba(0, 217, 255, 0.22);
}

body.is-chat-home .chat-root--home .chat-form textarea {
  grid-column: 4;
  min-height: 2.6rem;
  padding: 0.62rem 0.6rem;
  caret-color: var(--pf-chat-neon);
}

body.is-chat-home .chat-root--home .chat-form button[type="submit"] {
  display: none;
}

body.is-chat-home .chat-root--home .chat-send-icon {
  display: block !important;
  grid-column: 5 !important;
  grid-row: 1 !important;
  width: 2.85rem !important;
  max-width: 2.85rem !important;
  min-width: 2.85rem !important;
  height: 2.85rem !important;
  padding: 0 !important;
  margin: 0 !important;
  align-self: center !important;
}

body.is-chat-home .chat-root--home .chat-send-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.72rem;
  height: 0.72rem;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: translate(-62%, -50%) rotate(45deg);
}

body.is-chat-home .chat-root--home .chat-send-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.1rem;
  height: 2px;
  background: currentColor;
  transform: translate(-58%, -50%);
  box-shadow: 0 0 12px rgba(0, 217, 255, 0.7);
}

.chat-attachment-strip {
  display: flex;
  gap: 0.45rem;
  padding: 0.55rem 0.25rem 0;
}

.chat-attachment-strip.hidden {
  display: none;
}

.chat-attachment-chip {
  max-width: 100%;
  padding: 0.36rem 0.58rem;
  border: 1px solid rgba(0, 217, 255, 0.42);
  border-radius: 999px;
  color: #d9fbff;
  background: rgba(0, 217, 255, 0.08);
  font-size: 0.72rem;
}

@media (max-width: 900px) {
  body.is-chat-home .chat-root--home .chat-form {
    grid-template-columns: auto auto auto minmax(0, 1fr) auto;
  }

  body.is-chat-home .chat-root--home .chat-form button[type="submit"],
  body.is-chat-home .chat-root--home .chat-send-icon {
    grid-column: 5;
    width: 2.85rem;
  }
}

/* Annotation pass: flatter canvas, quieter controls */
body.is-chat-home .content {
  padding: 0;
}

body.is-chat-home .chat-root--home .chat-shell {
  border: 0;
  box-shadow: none;
}

body.is-chat-home .chat-root--home .chat-head {
  border-bottom: 1px solid rgba(0, 217, 255, 0.2);
}

body.is-chat-home .chat-root--home .chat-compose {
  padding: 0.85rem 1rem;
  border-top: 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

body.is-chat-home .chat-root--home .chat-form {
  grid-template-columns: auto auto auto minmax(0, 650px) auto;
  width: fit-content;
  max-width: 100%;
  border-radius: 6px;
  box-shadow: none;
}

body.is-chat-home .chat-root--home .chat-form textarea {
  width: min(650px, 100%);
  max-width: 650px;
}

body.is-chat-home .chat-root--home .chat-tool,
body.is-chat-home .chat-root--home .chat-send-icon,
.chat-theme-toggle {
  border-radius: 6px;
  box-shadow: none;
}

body.is-chat-home .chat-root--home .chat-send-icon {
  border-radius: 999px;
}

body.is-chat-home .chat-root--home .chat-tool--target::before {
  inset: 0.8rem;
  border-width: 1px;
  box-shadow: none;
}

body.is-chat-home .chat-root--home .chat-tool--target::after {
  top: 50%;
  left: 50%;
  width: 1.25rem;
  height: 1px;
  background: currentColor;
  transform: translate(-50%, -50%);
  box-shadow: 0 0.48rem 0 -0.5px currentColor, 0 -0.48rem 0 -0.5px currentColor;
  opacity: 0.72;
}

.tabs {
  background: #090d0f;
  border-color: rgba(0, 217, 255, 0.18);
}

.tab {
  color: rgba(218, 246, 250, 0.58);
  background: transparent;
  border-color: rgba(0, 217, 255, 0.12);
}

.tab:hover {
  color: #eaffff;
  background: rgba(0, 217, 255, 0.08);
}

.tab.active {
  color: #eaffff;
  background: rgba(0, 217, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(0, 217, 255, 0.5);
}

.nav-section-title {
  background: #111819;
  border-top: 1px solid rgba(0, 217, 255, 0.14);
  border-bottom: 1px solid rgba(0, 217, 255, 0.14);
  color: rgba(218, 246, 250, 0.7);
}

@media (max-width: 900px) {
  body.is-chat-home .content {
    padding: 0;
  }

  body.is-chat-home .chat-root--home .chat-shell {
    min-height: 100vh;
  }

  body.is-chat-home .chat-root--home .chat-form {
    width: 100%;
    grid-template-columns: auto auto auto minmax(0, 1fr) auto;
  }
}

/* Dark mode refinement: charcoal + light grey + neon blue accents */
:root[data-manual-theme="dark"] body,
:root[data-manual-theme="dark"] .main,
:root[data-manual-theme="dark"] body.is-chat-home .main {
  background: #050505;
}

:root[data-manual-theme="dark"] .sidebar,
:root[data-manual-theme="dark"] .nav-tree,
:root[data-manual-theme="dark"] .nav-section {
  background: #111111;
}

:root[data-manual-theme="dark"] .sidebar-header {
  background: #101010;
  border-bottom-color: #2a2a2a;
}

:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-shell {
  background: #101010;
  color: #e8e8e8;
}

:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-head {
  background: #151515;
  border-bottom-color: #2d2d2d;
}

:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-log {
  background: linear-gradient(180deg, #101010 0%, #080808 100%);
}

:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-compose {
  background: transparent;
  border-top-color: rgba(0, 217, 255, 0.18);
}

:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-form {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.05)),
    #151515;
  border-color: rgba(0, 217, 255, 0.52);
}

:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-form textarea {
  color: #d8d8d8;
}

:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-form textarea::placeholder {
  color: #8f8f8f;
}

:root[data-manual-theme="dark"] .tabs,
:root[data-manual-theme="dark"] .nav-section-title {
  background: #151515;
}

/* Light mode refinement: light grey + #222 + neon blue accents */
:root:not([data-manual-theme="dark"]) body,
:root:not([data-manual-theme="dark"]) .main,
:root:not([data-manual-theme="dark"]) body.is-chat-home .main {
  background: #e7e7e7;
  color: #222;
}

:root:not([data-manual-theme="dark"]) .sidebar,
:root:not([data-manual-theme="dark"]) .nav-tree,
:root:not([data-manual-theme="dark"]) .nav-section {
  background: #eeeeee;
  color: #222;
}

:root:not([data-manual-theme="dark"]) .sidebar-header {
  background: #f4f4f4;
  border-bottom-color: #d5d5d5;
}

:root:not([data-manual-theme="dark"]) .brand,
:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-title {
  color: #222;
}

:root:not([data-manual-theme="dark"]) .subtitle,
:root:not([data-manual-theme="dark"]) .nav-link,
:root:not([data-manual-theme="dark"]) .folder-label,
:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-scope {
  color: #5f5f5f;
}

:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-shell {
  background: #f2f2f2;
  color: #222;
}

:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-head {
  background: #eeeeee;
  border-bottom-color: #d4d4d4;
}

:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-log {
  background: linear-gradient(180deg, #f2f2f2 0%, #e8e8e8 100%);
}

:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-form {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.18)),
    #e2e2e2;
  border-color: rgba(0, 217, 255, 0.62);
}

:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-form textarea {
  color: #222;
}

:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-form textarea::placeholder {
  color: #747474;
}

:root:not([data-manual-theme="dark"]) .tabs,
:root:not([data-manual-theme="dark"]) .nav-section-title {
  background: #e2e2e2;
}

:root:not([data-manual-theme="dark"]) .tab {
  color: #5f5f5f;
}

:root:not([data-manual-theme="dark"]) .tab.active {
  color: #222;
  background: rgba(0, 217, 255, 0.16);
}

/* Composer refinement */
body.is-chat-home .chat-root--home .chat-compose {
  background: transparent !important;
  background-color: transparent !important;
  border-top: 0 !important;
}

body.is-chat-home .chat-root--home .chat-form::before {
  display: none;
}

body.is-chat-home .chat-root--home .chat-form {
  grid-template-columns: auto auto minmax(0, 650px) auto;
}

body.is-chat-home .chat-root--home .chat-tool--upload {
  grid-column: 1 !important;
}

body.is-chat-home .chat-root--home .chat-tool--target {
  grid-column: 2 !important;
}

body.is-chat-home .chat-root--home .chat-tool {
  align-self: center !important;
  justify-self: center !important;
  width: 1.85rem !important;
  min-width: 1.85rem !important;
  height: 1.85rem !important;
}

body.is-chat-home .chat-root--home .chat-form textarea {
  grid-column: 3;
  font-size: 0.78rem;
  line-height: 1.35;
}

body.is-chat-home .chat-root--home .chat-send-icon {
  grid-column: 4 !important;
}

/* Last-word response polish */
body.is-chat-home,
body.is-chat-home .app,
body.is-chat-home .main,
body.is-chat-home .content,
body.is-chat-home .manual-home,
body.is-chat-home .chat-home-slot,
body.is-chat-home .chat-root--home,
body.is-chat-home .chat-root--home .chat-shell,
body.is-chat-home .chat-root--home .chat-body,
body.is-chat-home .chat-root--home .chat-layout,
body.is-chat-home .chat-root--home .chat-main,
body.is-chat-home .chat-root--home .chat-log {
  background: var(--pf-chat-surface) !important;
  background-image: none !important;
}

:root[data-manual-theme="dark"] body.is-chat-home,
:root[data-manual-theme="dark"] body.is-chat-home .app,
:root[data-manual-theme="dark"] body.is-chat-home .main,
:root[data-manual-theme="dark"] body.is-chat-home .content,
:root[data-manual-theme="dark"] body.is-chat-home .manual-home,
:root[data-manual-theme="dark"] body.is-chat-home .chat-home-slot,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-shell,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-body,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-layout,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-main,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-log {
  background: #101010 !important;
  background-image: none !important;
}

body.is-chat-home .chat-root--home .chat-log {
  padding: 1.2rem 1.35rem 7.25rem !important;
}

body.is-chat-home .chat-root--home .chat-bubble {
  max-width: min(650px, 100%) !important;
  padding: 0.76rem 0.86rem !important;
  border-radius: 6px !important;
  font-size: 0.76rem !important;
  line-height: 1.52 !important;
  letter-spacing: 0 !important;
  box-shadow: none !important;
}

body.is-chat-home .chat-root--home .chat-bubble--assistant,
body.is-chat-home .chat-root--home .chat-bubble--user {
  background: var(--custom-panel) !important;
  color: var(--custom-copy) !important;
  border: 1px solid var(--custom-line) !important;
}

body.is-chat-home .chat-root--home .chat-bubble--user {
  color: var(--custom-ink) !important;
  border-color: var(--pf-chat-neon) !important;
}

body.is-chat-home .chat-root--home .chat-bubble--assistant .chat-answer-title {
  margin: 0 0 0.46rem !important;
  color: var(--custom-ink) !important;
  font-size: 1rem !important;
  line-height: 1.2 !important;
}

body.is-chat-home .chat-root--home .chat-bubble p,
body.is-chat-home .chat-root--home .chat-bubble li {
  color: var(--custom-copy) !important;
  font-size: inherit !important;
}

body.is-chat-home .chat-root--home .chat-bubble strong {
  color: var(--custom-ink) !important;
}

body.is-chat-home .chat-root--home .chat-media {
  max-width: 650px !important;
}

body.is-chat-home .chat-root--home .chat-media-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(108px, 138px)) !important;
  gap: 0.38rem !important;
  width: fit-content !important;
  max-width: 100% !important;
}

body.is-chat-home .chat-root--home .chat-figure {
  overflow: hidden !important;
  border: 1px solid var(--custom-line) !important;
  border-radius: 6px !important;
  background: var(--custom-panel) !important;
  box-shadow: none !important;
}

body.is-chat-home .chat-root--home .chat-figure img {
  display: block !important;
  width: 100% !important;
  height: 82px !important;
  max-height: 82px !important;
  object-fit: cover !important;
  background: var(--pf-chat-surface) !important;
}

body.is-chat-home .chat-root--home .chat-figure-link,
body.is-chat-home .chat-root--home .chat-source {
  border-radius: 6px !important;
  background: var(--custom-panel) !important;
  color: var(--custom-copy) !important;
  border-color: var(--custom-line) !important;
}

body.is-chat-home .chat-root--home .chat-figure-link {
  min-height: 1.32rem !important;
  margin: 0.24rem !important;
  padding: 0.2rem 0.36rem !important;
  font-size: 0.52rem !important;
  line-height: 1 !important;
}

body.is-chat-home .chat-root--home .chat-sources {
  max-width: 650px !important;
  margin: 0 auto 0.35rem !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
}

body.is-chat-home .chat-root--home .chat-sources-label {
  margin: 0 0 0.28rem !important;
  color: var(--custom-muted) !important;
  font-size: 0.56rem !important;
  letter-spacing: 0 !important;
}

body.is-chat-home .chat-root--home .chat-source-row {
  gap: 0.26rem !important;
}

body.is-chat-home .chat-root--home .chat-source {
  max-width: 14rem !important;
  padding: 0.24rem 0.48rem !important;
  overflow: hidden !important;
  font-size: 0.54rem !important;
  line-height: 1.1 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body.is-chat-home .chat-root--home .chat-figure-link:hover,
body.is-chat-home .chat-root--home .chat-source:hover {
  color: var(--custom-ink) !important;
  border-color: var(--pf-chat-neon) !important;
  background: var(--pf-chat-neon-soft) !important;
}

.chat-ticket-board {
  display: grid;
  gap: 0.72rem;
  width: 100%;
  max-width: min(760px, calc(100vw - 2rem));
  padding: 0.82rem;
  border: 1px solid var(--custom-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--custom-panel) 90%, #000 10%);
}

.chat-ticket-board-head {
  display: grid;
  gap: 0.18rem;
}

.chat-ticket-board-title {
  margin: 0;
  color: var(--custom-copy);
  font-size: 0.96rem;
  line-height: 1.2;
}

.chat-ticket-board-lead {
  margin: 0;
  color: var(--custom-muted);
  font-size: 0.62rem;
  line-height: 1.35;
}

.chat-ticket-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.52rem;
}

.chat-ticket-card {
  display: grid;
  gap: 0.34rem;
  align-content: start;
  min-height: 7.4rem;
  padding: 0.62rem 0.68rem;
  border: 1px solid var(--custom-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--custom-panel) 94%, #000 6%);
  color: var(--custom-copy);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.chat-ticket-card:hover,
.chat-ticket-card:focus-visible {
  border-color: color-mix(in srgb, var(--pf-chat-neon) 45%, var(--custom-line));
  background: color-mix(in srgb, var(--pf-chat-neon-soft, var(--custom-panel)) 55%, var(--custom-panel));
  outline: none;
}

.chat-ticket-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.chat-ticket-card-id {
  color: var(--pf-chat-neon);
  font-size: 0.58rem;
  font-weight: 700;
}

.chat-ticket-card-risk {
  display: inline-flex;
  align-items: center;
  min-height: 1.2rem;
  padding: 0.08rem 0.38rem;
  border-radius: 999px;
  font-size: 0.52rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.chat-ticket-card-risk.is-low {
  border: 1px solid color-mix(in srgb, #3ecf8e 35%, transparent);
  color: #3ecf8e;
  background: color-mix(in srgb, #3ecf8e 12%, var(--custom-panel));
}

.chat-ticket-card-risk.is-medium {
  border: 1px solid color-mix(in srgb, #ffb020 35%, transparent);
  color: #ffb020;
  background: color-mix(in srgb, #ffb020 12%, var(--custom-panel));
}

.chat-ticket-card-risk.is-high {
  border: 1px solid color-mix(in srgb, #ff5d5d 35%, transparent);
  color: #ff5d5d;
  background: color-mix(in srgb, #ff5d5d 12%, var(--custom-panel));
}

.chat-ticket-card-subject {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--custom-copy);
  font-size: 0.72rem;
  line-height: 1.25;
}

.chat-ticket-card-intent {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 0.1rem 0.38rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--pf-chat-neon) 28%, var(--custom-line));
  background: color-mix(in srgb, var(--pf-chat-neon-soft, var(--custom-panel)) 45%, var(--custom-panel));
  color: var(--pf-chat-neon);
  font-size: 0.52rem;
  font-weight: 700;
  line-height: 1.2;
}

.chat-ticket-card-admin {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--custom-muted);
  font-size: 0.56rem;
  line-height: 1.3;
}

.chat-ticket-intel {
  display: grid;
  gap: 0.46rem;
  padding: 0.62rem 0.68rem;
  border: 1px solid color-mix(in srgb, var(--pf-chat-neon) 22%, var(--custom-line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--custom-panel) 92%, #000 8%);
}

.chat-ticket-intel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.34rem;
}

.chat-ticket-intel-label {
  color: var(--custom-muted);
  font-size: 0.54rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.chat-ticket-intel-title {
  color: var(--custom-copy);
  font-size: 0.68rem;
  line-height: 1.25;
}

.chat-ticket-intel-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.2rem;
  padding: 0.06rem 0.38rem;
  border-radius: 999px;
  border: 1px solid var(--custom-line);
  color: var(--custom-copy);
  font-size: 0.52rem;
  font-weight: 600;
  text-transform: capitalize;
}

.chat-ticket-intel-list {
  margin: 0;
  padding-left: 1rem;
  color: var(--custom-copy);
  font-size: 0.6rem;
  line-height: 1.4;
}

.chat-ticket-intel-list li + li {
  margin-top: 0.2rem;
}

.chat-ticket-quick-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.34rem;
}

.chat-ticket-quick-note {
  max-width: 100%;
  padding: 0.28rem 0.52rem;
  border: 1px solid var(--custom-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--custom-panel) 96%, #000 4%);
  color: var(--custom-copy);
  font-size: 0.56rem;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.chat-ticket-quick-note:hover {
  border-color: color-mix(in srgb, var(--pf-chat-neon) 35%, var(--custom-line));
  color: var(--pf-chat-neon);
}

.chat-ticket-card-snippet {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  color: var(--custom-muted);
  font-size: 0.6rem;
  line-height: 1.35;
}

.chat-ticket-card-meta {
  margin-top: auto;
  color: var(--custom-muted);
  font-size: 0.54rem;
  line-height: 1.3;
}

.chat-ticket-thread-panel {
  display: grid;
  gap: 0.72rem;
}

.chat-ticket-thread-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.42rem 0.8rem;
  align-items: start;
}

.chat-ticket-thread-eyebrow {
  margin: 0;
  color: var(--pf-chat-neon);
  font-size: 0.58rem;
  font-weight: 700;
}

.chat-ticket-thread-title {
  margin: 0.12rem 0 0;
  color: var(--custom-copy);
  font-size: 0.92rem;
  line-height: 1.25;
}

.chat-ticket-thread-meta {
  margin: 0.18rem 0 0;
  color: var(--custom-muted);
  font-size: 0.58rem;
  line-height: 1.35;
}

.chat-ticket-thread-link {
  color: var(--pf-chat-neon);
  font-size: 0.58rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.chat-ticket-thread-link:hover {
  text-decoration: underline;
}

.chat-ticket-thread-body {
  display: grid;
  gap: 0.52rem;
  max-height: 18rem;
  overflow: auto;
  padding-right: 0.2rem;
}

.chat-ticket-comment {
  display: grid;
  gap: 0.28rem;
  padding: 0.56rem 0.62rem;
  border: 1px solid var(--custom-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--custom-panel) 96%, #000 4%);
}

.chat-ticket-comment--client {
  border-color: color-mix(in srgb, var(--pf-chat-neon) 28%, var(--custom-line));
}

.chat-ticket-comment header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.chat-ticket-comment-who {
  color: var(--custom-copy);
  font-size: 0.58rem;
  font-weight: 700;
}

.chat-ticket-comment time {
  color: var(--custom-muted);
  font-size: 0.54rem;
}

.chat-ticket-comment-body {
  color: var(--custom-copy);
  font-size: 0.64rem;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
}

.chat-ticket-thread-empty,
.chat-ticket-thread-loading,
.chat-ticket-thread-error {
  margin: 0;
  color: var(--custom-muted);
  font-size: 0.64rem;
}

.chat-ticket-thread-error {
  color: #ff5d5d;
}

.chat-ticket-respond {
  display: grid;
  gap: 0.42rem;
  padding-top: 0.2rem;
  border-top: 1px solid var(--custom-line);
}

.chat-ticket-respond-label {
  color: var(--custom-copy);
  font-size: 0.62rem;
  font-weight: 600;
}

.chat-ticket-respond-input {
  width: 100%;
  min-height: 4.8rem;
  padding: 0.56rem 0.62rem;
  border: 1px solid var(--custom-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--custom-panel) 96%, #000 4%);
  color: var(--custom-copy);
  font: inherit;
  font-size: 0.64rem;
  line-height: 1.4;
  resize: vertical;
}

.chat-ticket-respond-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--pf-chat-neon) 45%, var(--custom-line));
}

.chat-ticket-respond-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.chat-ticket-respond-btn,
.chat-ticket-thread-close {
  min-height: 1.9rem;
  padding: 0.28rem 0.68rem;
  border: 1px solid var(--custom-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--custom-panel) 94%, #000 6%);
  color: var(--custom-copy);
  font-size: 0.6rem;
  font-weight: 600;
  cursor: pointer;
}

.chat-ticket-respond-btn {
  border-color: color-mix(in srgb, var(--pf-chat-neon) 35%, var(--custom-line));
  color: var(--pf-chat-neon);
}

.chat-ticket-respond-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.chat-ticket-draft-output {
  margin: 0;
  padding: 0.62rem 0.68rem;
  border: 1px solid color-mix(in srgb, var(--pf-chat-neon) 25%, var(--custom-line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--custom-panel) 92%, #000 8%);
  color: var(--custom-copy);
  font-family: inherit;
  font-size: 0.64rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* True final pass: keep sidebar/search/nav cohesive after older chat rules. */
:root:not([data-manual-theme="dark"]) body,
:root:not([data-manual-theme="dark"]) .app,
:root:not([data-manual-theme="dark"]) .main,
:root:not([data-manual-theme="dark"]) .content,
:root:not([data-manual-theme="dark"]) body.is-chat-home,
:root:not([data-manual-theme="dark"]) body.is-chat-home .main,
:root:not([data-manual-theme="dark"]) body.is-chat-home .content,
:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home,
:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-shell,
:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-body,
:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-layout,
:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-main,
:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-log {
  background: #e7e7e7 !important;
  background-image: none !important;
  color: #222222 !important;
}

:root:not([data-manual-theme="dark"]) .sidebar,
:root:not([data-manual-theme="dark"]) .sidebar-header,
:root:not([data-manual-theme="dark"]) .nav-tree {
  background: #e2e2e2 !important;
  background-image: none !important;
  color: #222222 !important;
}

:root:not([data-manual-theme="dark"]) .brand,
:root:not([data-manual-theme="dark"]) .subtitle,
:root:not([data-manual-theme="dark"]) .tab,
:root:not([data-manual-theme="dark"]) .nav-section-title,
:root:not([data-manual-theme="dark"]) .nav-folder summary,
:root:not([data-manual-theme="dark"]) .folder-label,
:root:not([data-manual-theme="dark"]) .folder-desc,
:root:not([data-manual-theme="dark"]) .nav-link,
:root:not([data-manual-theme="dark"]) .folder-count {
  color: #222222 !important;
}

:root:not([data-manual-theme="dark"]) .tabs,
:root:not([data-manual-theme="dark"]) .nav-section,
:root:not([data-manual-theme="dark"]) .nav-folder--topic[open],
:root:not([data-manual-theme="dark"]) .folder-count {
  background: #d9d9d9 !important;
  background-image: none !important;
  border-color: #bcbcbc !important;
}

:root:not([data-manual-theme="dark"]) #search {
  background: #d0d0d0 !important;
  background-image: none !important;
  border-color: #00d9ff !important;
  color: #222222 !important;
}

:root:not([data-manual-theme="dark"]) #search::placeholder {
  color: #6f6f6f !important;
}

:root:not([data-manual-theme="dark"]) .tab.active,
:root:not([data-manual-theme="dark"]) .tab:hover,
:root:not([data-manual-theme="dark"]) .nav-link:hover,
:root:not([data-manual-theme="dark"]) .nav-link.active {
  background: #cfcfcf !important;
  background-image: none !important;
  border-color: #00d9ff !important;
  color: #222222 !important;
}

:root:not([data-manual-theme="dark"]) .manual-theme-toggle,
:root:not([data-manual-theme="dark"]) .sidebar-toggle,
:root:not([data-manual-theme="dark"]) .nav-folder summary::before,
:root:not([data-manual-theme="dark"]) .nav-folder[open] summary::before {
  background-color: #d9d9d9 !important;
  border-color: #00d9ff !important;
  color: #00d9ff !important;
}

:root[data-manual-theme="dark"] .sidebar,
:root[data-manual-theme="dark"] .sidebar-header,
:root[data-manual-theme="dark"] .nav-tree,
:root[data-manual-theme="dark"] .nav-section,
:root[data-manual-theme="dark"] .nav-folder--topic[open] {
  background: #151515 !important;
  background-image: none !important;
  color: #d0d0d0 !important;
}

:root[data-manual-theme="dark"] .tabs,
:root[data-manual-theme="dark"] #search,
:root[data-manual-theme="dark"] .folder-count,
:root[data-manual-theme="dark"] .manual-theme-toggle,
:root[data-manual-theme="dark"] .sidebar-toggle {
  background: #111111 !important;
  background-image: none !important;
  border-color: #2a2a2a !important;
  color: #d0d0d0 !important;
}

:root[data-manual-theme="dark"] .tab,
:root[data-manual-theme="dark"] .nav-section-title,
:root[data-manual-theme="dark"] .nav-folder summary,
:root[data-manual-theme="dark"] .folder-label,
:root[data-manual-theme="dark"] .folder-desc,
:root[data-manual-theme="dark"] .nav-link {
  color: #d0d0d0 !important;
}

:root[data-manual-theme="dark"] .tab.active,
:root[data-manual-theme="dark"] .tab:hover,
:root[data-manual-theme="dark"] .nav-link:hover,
:root[data-manual-theme="dark"] .nav-link.active {
  background: #222222 !important;
  background-image: none !important;
  border-color: #00d9ff !important;
  color: #e8e8e8 !important;
}

:root[data-manual-theme="dark"] #search {
  border-color: #00d9ff !important;
}

:root[data-manual-theme="dark"] #search::placeholder {
  color: #9a9a9a !important;
}

:root[data-manual-theme="dark"] .manual-theme-toggle,
:root[data-manual-theme="dark"] .sidebar-toggle,
:root[data-manual-theme="dark"] .nav-folder summary::before,
:root[data-manual-theme="dark"] .nav-folder[open] summary::before {
  border-color: #00d9ff !important;
  color: #00d9ff !important;
}

/* Final sidebar/theme cleanup: greys, #222 text, neon blue accents. */
:root:not([data-manual-theme="dark"]) body,
:root:not([data-manual-theme="dark"]) .app,
:root:not([data-manual-theme="dark"]) .main,
:root:not([data-manual-theme="dark"]) .content,
:root:not([data-manual-theme="dark"]) .manual-home,
:root:not([data-manual-theme="dark"]) .chat-home-slot,
:root:not([data-manual-theme="dark"]) body.is-chat-home,
:root:not([data-manual-theme="dark"]) body.is-chat-home .main,
:root:not([data-manual-theme="dark"]) body.is-chat-home .content,
:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home,
:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-shell,
:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-body,
:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-layout,
:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-main,
:root:not([data-manual-theme="dark"]) body.is-chat-home .chat-root--home .chat-log {
  background: #e7e7e7 !important;
  background-image: none !important;
  color: #222222 !important;
}

:root:not([data-manual-theme="dark"]) .sidebar,
:root:not([data-manual-theme="dark"]) .sidebar-header,
:root:not([data-manual-theme="dark"]) .nav-tree {
  background: #e2e2e2 !important;
  background-image: none !important;
  color: #222222 !important;
}

:root:not([data-manual-theme="dark"]) .brand,
:root:not([data-manual-theme="dark"]) .subtitle,
:root:not([data-manual-theme="dark"]) .tab,
:root:not([data-manual-theme="dark"]) .nav-section-title,
:root:not([data-manual-theme="dark"]) .nav-folder summary,
:root:not([data-manual-theme="dark"]) .folder-label,
:root:not([data-manual-theme="dark"]) .folder-desc,
:root:not([data-manual-theme="dark"]) .nav-link {
  color: #222222 !important;
}

:root:not([data-manual-theme="dark"]) .tabs,
:root:not([data-manual-theme="dark"]) #search,
:root:not([data-manual-theme="dark"]) .nav-section,
:root:not([data-manual-theme="dark"]) .nav-folder--topic[open],
:root:not([data-manual-theme="dark"]) .folder-count,
:root:not([data-manual-theme="dark"]) .manual-theme-toggle,
:root:not([data-manual-theme="dark"]) .sidebar-toggle {
  background: #d9d9d9 !important;
  background-image: none !important;
  border-color: #bcbcbc !important;
  color: #222222 !important;
}

:root:not([data-manual-theme="dark"]) #search {
  background: #d0d0d0 !important;
  border-color: #00d9ff !important;
}

:root:not([data-manual-theme="dark"]) #search::placeholder {
  color: #6f6f6f !important;
}

:root:not([data-manual-theme="dark"]) .tab.active,
:root:not([data-manual-theme="dark"]) .tab:hover,
:root:not([data-manual-theme="dark"]) .nav-link:hover,
:root:not([data-manual-theme="dark"]) .nav-link.active {
  background: #cfcfcf !important;
  background-image: none !important;
  border-color: #00d9ff !important;
  color: #222222 !important;
}

:root:not([data-manual-theme="dark"]) .folder-count {
  color: #222222 !important;
}

:root:not([data-manual-theme="dark"]) .nav-folder summary::before,
:root:not([data-manual-theme="dark"]) .nav-folder[open] summary::before,
:root:not([data-manual-theme="dark"]) .manual-theme-toggle,
:root:not([data-manual-theme="dark"]) .sidebar-toggle {
  border-color: #00d9ff !important;
  color: #00d9ff !important;
}

:root[data-manual-theme="dark"] .sidebar,
:root[data-manual-theme="dark"] .sidebar-header,
:root[data-manual-theme="dark"] .nav-tree,
:root[data-manual-theme="dark"] .nav-section,
:root[data-manual-theme="dark"] .nav-folder--topic[open] {
  background: #151515 !important;
  background-image: none !important;
  color: #d0d0d0 !important;
}

:root[data-manual-theme="dark"] .tabs,
:root[data-manual-theme="dark"] #search,
:root[data-manual-theme="dark"] .folder-count,
:root[data-manual-theme="dark"] .manual-theme-toggle,
:root[data-manual-theme="dark"] .sidebar-toggle {
  background: #111111 !important;
  background-image: none !important;
  border-color: #2a2a2a !important;
  color: #d0d0d0 !important;
}

:root[data-manual-theme="dark"] .tab,
:root[data-manual-theme="dark"] .nav-section-title,
:root[data-manual-theme="dark"] .nav-folder summary,
:root[data-manual-theme="dark"] .folder-label,
:root[data-manual-theme="dark"] .folder-desc,
:root[data-manual-theme="dark"] .nav-link {
  color: #d0d0d0 !important;
}

:root[data-manual-theme="dark"] .tab.active,
:root[data-manual-theme="dark"] .tab:hover,
:root[data-manual-theme="dark"] .nav-link:hover,
:root[data-manual-theme="dark"] .nav-link.active {
  background: #222222 !important;
  background-image: none !important;
  border-color: #00d9ff !important;
  color: #e8e8e8 !important;
}

:root[data-manual-theme="dark"] #search {
  border-color: #00d9ff !important;
}

:root[data-manual-theme="dark"] #search::placeholder {
  color: #9a9a9a !important;
}

:root[data-manual-theme="dark"] .manual-theme-toggle,
:root[data-manual-theme="dark"] .sidebar-toggle,
:root[data-manual-theme="dark"] .nav-folder summary::before,
:root[data-manual-theme="dark"] .nav-folder[open] summary::before {
  border-color: #00d9ff !important;
  color: #00d9ff !important;
}

/* Final alignment nudge */
body.is-sidebar-collapsed .manual-theme-toggle {
  left: 3px !important;
  top: 3px !important;
}

body.is-sidebar-collapsed .sidebar-toggle {
  left: 3px !important;
  top: calc(3px + 1.85rem + 6px) !important;
  width: 1.85rem !important;
  height: 1.85rem !important;
}

body.is-chat-home .chat-root--home .chat-form {
  align-items: center !important;
  grid-template-columns: 1.85rem 1.85rem minmax(0, 650px) 2.15rem !important;
  gap: 0.32rem !important;
  min-height: 3.05rem !important;
  padding: 0.32rem !important;
}

body.is-chat-home .chat-root--home .chat-tool {
  align-self: center !important;
  justify-self: center !important;
  width: 1.85rem !important;
  min-width: 1.85rem !important;
  height: 1.85rem !important;
}

body.is-chat-home .chat-root--home .chat-form textarea {
  align-self: center !important;
  min-height: 2rem !important;
  height: 2rem !important;
  padding: 0.36rem 0.46rem !important;
}

body.is-chat-home .chat-root--home .chat-send-icon {
  align-self: center !important;
  justify-self: center !important;
  width: 2.15rem !important;
  min-width: 2.15rem !important;
  max-width: 2.15rem !important;
  height: 2.15rem !important;
}

body.is-chat-home .chat-root--home .chat-form {
  background: rgba(238, 238, 238, 0.72) !important;
  background-image: none !important;
  border-color: var(--pf-chat-neon) !important;
  box-shadow: 0 0 0 1px rgba(0, 217, 255, 0.18) inset !important;
}

:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-form {
  background: rgba(21, 21, 21, 0.78) !important;
  background-image: none !important;
}

body.is-chat-home .chat-root--home .chat-tool,
body.is-chat-home .chat-root--home .chat-send-icon {
  background: rgba(238, 238, 238, 0.6) !important;
  background-image: none !important;
  border-color: var(--pf-chat-neon) !important;
  color: var(--pf-chat-neon) !important;
}

:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-tool,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-send-icon {
  background: rgba(21, 21, 21, 0.78) !important;
  background-image: none !important;
}

/* Final response-state polish */
body.is-chat-home,
body.is-chat-home .app,
body.is-chat-home .main,
body.is-chat-home .content,
body.is-chat-home .manual-home,
body.is-chat-home .chat-home-slot,
body.is-chat-home .chat-root--home,
body.is-chat-home .chat-root--home .chat-shell,
body.is-chat-home .chat-root--home .chat-body,
body.is-chat-home .chat-root--home .chat-layout,
body.is-chat-home .chat-root--home .chat-main,
body.is-chat-home .chat-root--home .chat-log {
  background: var(--pf-chat-surface) !important;
  background-image: none !important;
}

:root[data-manual-theme="dark"] body.is-chat-home,
:root[data-manual-theme="dark"] body.is-chat-home .app,
:root[data-manual-theme="dark"] body.is-chat-home .main,
:root[data-manual-theme="dark"] body.is-chat-home .content,
:root[data-manual-theme="dark"] body.is-chat-home .manual-home,
:root[data-manual-theme="dark"] body.is-chat-home .chat-home-slot,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-shell,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-body,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-layout,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-main,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-log {
  background: #101010 !important;
  background-image: none !important;
}

body.is-chat-home .chat-root--home .chat-log {
  padding: 1.2rem 1.35rem 7.25rem !important;
}

body.is-chat-home .chat-root--home .chat-bubble {
  max-width: min(650px, 100%) !important;
  padding: 0.76rem 0.86rem !important;
  border-radius: 6px !important;
  font-size: 0.76rem !important;
  line-height: 1.52 !important;
  letter-spacing: 0 !important;
  box-shadow: none !important;
}

body.is-chat-home .chat-root--home .chat-bubble--assistant {
  background: var(--custom-panel) !important;
  color: var(--custom-copy) !important;
  border: 1px solid var(--custom-line) !important;
}

body.is-chat-home .chat-root--home .chat-bubble--user {
  background: var(--custom-panel) !important;
  color: var(--custom-ink) !important;
  border: 1px solid var(--pf-chat-neon) !important;
}

body.is-chat-home .chat-root--home .chat-bubble--assistant .chat-answer-title {
  margin: 0 0 0.46rem !important;
  color: var(--custom-ink) !important;
  font-size: 1rem !important;
  line-height: 1.2 !important;
}

body.is-chat-home .chat-root--home .chat-bubble p,
body.is-chat-home .chat-root--home .chat-bubble li {
  color: var(--custom-copy) !important;
  font-size: inherit !important;
}

body.is-chat-home .chat-root--home .chat-bubble strong {
  color: var(--custom-ink) !important;
}

body.is-chat-home .chat-root--home .chat-media {
  max-width: 650px !important;
}

body.is-chat-home .chat-root--home .chat-media-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(108px, 138px)) !important;
  gap: 0.38rem !important;
  width: fit-content !important;
  max-width: 100% !important;
}

body.is-chat-home .chat-root--home .chat-figure {
  overflow: hidden !important;
  border: 1px solid var(--custom-line) !important;
  border-radius: 6px !important;
  background: var(--custom-panel) !important;
  box-shadow: none !important;
}

body.is-chat-home .chat-root--home .chat-figure img {
  display: block !important;
  width: 100% !important;
  height: 82px !important;
  max-height: 82px !important;
  object-fit: cover !important;
  background: var(--pf-chat-surface) !important;
}

body.is-chat-home .chat-root--home .chat-figure-link {
  min-height: 1.32rem !important;
  margin: 0.24rem !important;
  padding: 0.2rem 0.36rem !important;
  border-radius: 6px !important;
  font-size: 0.52rem !important;
  line-height: 1 !important;
  background: var(--custom-panel) !important;
  color: var(--custom-copy) !important;
  border-color: var(--custom-line) !important;
}

body.is-chat-home .chat-root--home .chat-figure-link:hover {
  color: var(--custom-ink) !important;
  border-color: var(--pf-chat-neon) !important;
  background: var(--pf-chat-neon-soft) !important;
}

body.is-chat-home .chat-root--home .chat-sources {
  max-width: 650px !important;
  margin: 0 auto 0.35rem !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
}

body.is-chat-home .chat-root--home .chat-sources-label {
  margin: 0 0 0.28rem !important;
  color: var(--custom-muted) !important;
  font-size: 0.56rem !important;
  letter-spacing: 0 !important;
}

body.is-chat-home .chat-root--home .chat-source-row {
  gap: 0.26rem !important;
}

body.is-chat-home .chat-root--home .chat-source {
  max-width: 14rem !important;
  padding: 0.24rem 0.48rem !important;
  border-radius: 6px !important;
  overflow: hidden !important;
  color: var(--custom-copy) !important;
  background: var(--custom-panel) !important;
  border-color: var(--custom-line) !important;
  font-size: 0.54rem !important;
  line-height: 1.1 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body.is-chat-home .chat-root--home .chat-source:hover {
  color: var(--custom-ink) !important;
  border-color: var(--pf-chat-neon) !important;
  background: var(--pf-chat-neon-soft) !important;
}

/* Current truth: no chat header, no compose band, compact glass input */
body.is-chat-home .chat-root--home .chat-head {
  display: none !important;
}

body.is-chat-home .chat-root--home .chat-compose {
  background: transparent !important;
  background-color: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.is-chat-home .chat-root--home .chat-form {
  grid-template-columns: auto auto minmax(0, 650px) auto !important;
  gap: 0.22rem !important;
  padding: 0.22rem !important;
  border-radius: 6px !important;
  background: rgba(21, 21, 21, 0.78) !important;
  background-image: none !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

body.is-chat-home .chat-root--home .chat-tool {
  width: 1.85rem !important;
  min-width: 1.85rem !important;
  height: 1.85rem !important;
  border-radius: 4px !important;
  background: rgba(0, 217, 255, 0.07) !important;
}

body.is-chat-home .chat-root--home .chat-form textarea {
  grid-column: 3 !important;
  min-height: 1.85rem !important;
  padding: 0.32rem 0.48rem !important;
  font-size: 0.78rem !important;
  line-height: 1.35 !important;
}

body.is-chat-home .chat-root--home .chat-send-icon {
  grid-column: 4 !important;
  width: 2rem !important;
  min-width: 2rem !important;
  max-width: 2rem !important;
  height: 2rem !important;
}

/* Sidebar toggle placement + invisible compose wrapper */
.sidebar-toggle {
  top: 6.6rem !important;
  width: 1.15rem !important;
  height: 2.1rem !important;
  left: calc(var(--custom-sidebar-width) - 0.58rem) !important;
  border-radius: 4px !important;
}

.sidebar-toggle::before {
  width: 0.34rem !important;
  height: 0.34rem !important;
  border-left-width: 1.5px !important;
  border-bottom-width: 1.5px !important;
}

body.is-sidebar-collapsed .sidebar-toggle {
  left: 0.55rem !important;
  top: 6.6rem !important;
}

body.is-chat-home .chat-root--home .chat-compose {
  background: none !important;
  background-color: transparent !important;
  background-image: none !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 1rem 0.85rem !important;
  pointer-events: none;
}

body.is-chat-home .chat-root--home .chat-form,
body.is-chat-home .chat-root--home .chat-attachment-strip {
  pointer-events: auto;
}

/* Header removal + external theme toggle + glass composer */
body.is-chat-home .chat-root--home .chat-head {
  display: none !important;
}

body.is-chat-home .chat-root--home .chat-compose {
  background: none !important;
  background-color: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.is-chat-home .chat-root--home .chat-form {
  padding: 0.22rem !important;
  gap: 0.22rem !important;
  border-radius: 6px !important;
  background: rgba(21, 21, 21, 0.78) !important;
  background-image: none !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

body.is-chat-home .chat-root--home .chat-tool {
  width: 1.85rem !important;
  min-width: 1.85rem !important;
  height: 1.85rem !important;
  border-radius: 4px !important;
  background: rgba(0, 217, 255, 0.07) !important;
}

body.is-chat-home .chat-root--home .chat-send-icon {
  width: 2rem !important;
  min-width: 2rem !important;
  max-width: 2rem !important;
  height: 2rem !important;
}

/* Chat response refinement */
body.is-chat-home .chat-root--home .chat-main,
body.is-chat-home .chat-root--home .chat-body,
body.is-chat-home .chat-root--home .chat-layout,
body.is-chat-home .chat-root--home .chat-log {
  background: var(--pf-chat-surface) !important;
  background-image: none !important;
}

:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-main,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-body,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-layout,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-log {
  background: #101010 !important;
}

body.is-chat-home .chat-root--home .chat-bubble {
  font-size: 0.78rem !important;
  line-height: 1.55 !important;
}

body.is-chat-home .chat-root--home .chat-bubble--assistant {
  background: var(--custom-panel) !important;
  color: var(--custom-copy) !important;
  border-color: var(--custom-line) !important;
  box-shadow: none !important;
}

body.is-chat-home .chat-root--home .chat-bubble--user {
  background: var(--pf-chat-neon-soft) !important;
  color: var(--custom-ink) !important;
  border-color: var(--pf-chat-neon) !important;
}

body.is-chat-home .chat-root--home .chat-bubble--assistant .chat-answer-title {
  font-size: 1.05rem !important;
  color: var(--custom-ink) !important;
}

body.is-chat-home .chat-media-grid {
  grid-template-columns: repeat(auto-fit, minmax(120px, 180px)) !important;
  gap: 0.45rem !important;
}

body.is-chat-home .chat-figure {
  border-color: var(--custom-line) !important;
  background: var(--custom-panel) !important;
  box-shadow: none !important;
}

body.is-chat-home .chat-figure img {
  max-height: 120px !important;
}

body.is-chat-home .chat-figure-link {
  min-height: 1.55rem !important;
  padding: 0.28rem 0.45rem !important;
  margin: 0.35rem !important;
  font-size: 0.58rem !important;
  border-radius: 6px !important;
}

body.is-chat-home .chat-sources {
  max-width: 650px !important;
  margin: 0 auto !important;
  padding: 0.45rem 0.25rem 0 !important;
  background: transparent !important;
}

body.is-chat-home .chat-sources-label {
  color: var(--custom-muted) !important;
  font-size: 0.58rem !important;
}

body.is-chat-home .chat-source-row {
  gap: 0.3rem !important;
}

body.is-chat-home .chat-source {
  padding: 0.28rem 0.5rem !important;
  font-size: 0.58rem !important;
  border-radius: 999px !important;
  background: var(--custom-panel) !important;
  color: var(--custom-copy) !important;
  border-color: var(--custom-line) !important;
}

body.is-chat-home .chat-root--home .chat-form textarea {
  min-height: 1.85rem !important;
  padding: 0.32rem 0.48rem !important;
}

.manual-theme-toggle {
  position: fixed;
  left: calc(var(--custom-sidebar-width) - 2.75rem);
  top: 0.85rem;
  z-index: 131;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 1px solid var(--pf-chat-neon);
  border-radius: 6px;
  color: var(--pf-chat-neon);
  background: var(--custom-panel);
  cursor: pointer;
}

.manual-theme-toggle-icon {
  position: absolute;
  inset: 0.46rem;
  border-radius: 999px;
  background: currentColor;
}

:root[data-manual-theme="dark"] .manual-theme-toggle-icon {
  background: transparent;
  box-shadow: inset 0.32rem 0 0 currentColor;
}

body.is-sidebar-collapsed .manual-theme-toggle {
  left: 3px;
  top: 3px;
}

/* Sidebar collapse + tighter composer */
.sidebar-toggle {
  position: fixed;
  left: calc(var(--custom-sidebar-width) - 0.8rem);
  top: 50%;
  z-index: 130;
  width: 1.6rem;
  height: 3.2rem;
  padding: 0;
  border: 1px solid var(--pf-chat-neon);
  border-radius: 6px;
  background: var(--custom-panel);
  color: var(--pf-chat-neon);
  cursor: pointer;
}

.sidebar-toggle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.48rem;
  height: 0.48rem;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translate(-35%, -50%) rotate(45deg);
}

body.is-sidebar-collapsed .app {
  grid-template-columns: 0 minmax(0, 1fr);
}

body.is-sidebar-collapsed .sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

body.is-sidebar-collapsed .sidebar-toggle {
  left: 3px;
  top: calc(3px + 1.85rem + 6px);
  width: 1.85rem;
  height: 1.85rem;
}

body.is-sidebar-collapsed .sidebar-toggle::before {
  transform: translate(-65%, -50%) rotate(225deg);
}

body.is-chat-home .chat-root--home .chat-form {
  gap: 0.28rem !important;
  padding: 0.32rem !important;
}

body.is-chat-home .chat-root--home .chat-tool {
  width: 2.05rem !important;
  min-width: 2.05rem !important;
  height: 2.05rem !important;
}

body.is-chat-home .chat-root--home .chat-send-icon {
  width: 2.25rem !important;
  min-width: 2.25rem !important;
  max-width: 2.25rem !important;
  height: 2.25rem !important;
}

body.is-chat-home .chat-root--home .chat-form textarea {
  min-height: 2.05rem !important;
  padding: 0.42rem 0.5rem !important;
}

/* Strict palette: greys + neon blue only */
:root,
:root:not([data-manual-theme="dark"]) {
  --custom-bg: #e7e7e7;
  --custom-paper: #f2f2f2;
  --custom-panel: #eeeeee;
  --custom-ink: #222222;
  --custom-copy: #222222;
  --custom-muted: #6f6f6f;
  --custom-line: #d0d0d0;
  --custom-accent: #00d9ff;
  --custom-accent-soft: rgba(0, 217, 255, 0.12);
  --custom-accent-line: rgba(0, 217, 255, 0.5);
  --custom-warm: #00d9ff;
  --pf-chat-stage: #e7e7e7;
  --pf-chat-surface: #f2f2f2;
  --pf-chat-surface-soft: #e5e5e5;
  --pf-chat-ink: #222222;
  --pf-chat-muted: #6f6f6f;
  --pf-chat-line: #d0d0d0;
  --pf-chat-neon: #00d9ff;
  --pf-chat-neon-strong: #00d9ff;
  --pf-chat-neon-soft: rgba(0, 217, 255, 0.12);
  --pf-chat-panel: #e0e0e0;
  --pf-chat-panel-2: #d8d8d8;
}

:root[data-manual-theme="dark"] {
  --custom-bg: #050505;
  --custom-paper: #111111;
  --custom-panel: #151515;
  --custom-ink: #e8e8e8;
  --custom-copy: #d0d0d0;
  --custom-muted: #9a9a9a;
  --custom-line: #2a2a2a;
  --custom-accent: #00d9ff;
  --custom-accent-soft: rgba(0, 217, 255, 0.12);
  --custom-accent-line: rgba(0, 217, 255, 0.5);
  --custom-warm: #00d9ff;
  --pf-chat-stage: #050505;
  --pf-chat-surface: #101010;
  --pf-chat-surface-soft: #080808;
  --pf-chat-ink: #e8e8e8;
  --pf-chat-muted: #9a9a9a;
  --pf-chat-line: #2a2a2a;
  --pf-chat-neon: #00d9ff;
  --pf-chat-neon-strong: #00d9ff;
  --pf-chat-neon-soft: rgba(0, 217, 255, 0.12);
  --pf-chat-panel: #151515;
  --pf-chat-panel-2: #1c1c1c;
}

body,
.app,
.main,
.content,
.manual-home,
.chat-home-slot,
.sidebar,
.sidebar-header,
.nav-tree,
.nav-section,
.panel,
.chat-shell,
.chat-head,
.chat-log,
.welcome-home,
.ai-panel {
  background-color: var(--custom-panel);
  color: var(--custom-copy);
}

body.is-chat-home .main,
body.is-chat-home .content,
body.is-chat-home .chat-root--home .chat-shell,
body.is-chat-home .chat-root--home .chat-log {
  background:
    linear-gradient(180deg, var(--pf-chat-surface) 0%, var(--pf-chat-surface-soft) 100%);
  color: var(--pf-chat-ink);
}

body.is-chat-home .chat-root--home .chat-head {
  background: var(--custom-panel);
  border-color: var(--custom-line);
}

body.is-chat-home .chat-root--home .chat-compose {
  background: transparent;
}

.brand,
.chat-title,
.welcome-home-title,
.article-title,
.prose h1,
.prose h2,
.prose h3,
.prose h4,
.nav-folder summary,
.folder-label,
.nav-link,
.tab,
body.is-chat-home .chat-root--home .chat-title {
  color: var(--custom-ink);
}

.subtitle,
.main-top-label,
.chat-scope,
.chat-side-note,
.welcome-home-lead,
.welcome-home-card-desc,
.folder-count,
.nav-section-title,
.prose p,
.prose li {
  color: var(--custom-muted);
}

.chat-eyebrow,
body.is-chat-home .chat-root--home .chat-eyebrow,
.prose a,
.chat-inline-link,
.welcome-home-foot a {
  color: var(--pf-chat-neon);
}

.tabs,
.nav-section-title,
.tab,
.nav-link,
.nav-folder--topic[open],
.chat-bubble--assistant,
.chat-form,
.chat-tool,
.chat-send-icon,
.chat-theme-toggle,
.chat-close,
.folder-count {
  border-color: var(--custom-line);
  background-color: var(--custom-panel);
}

.tab.active,
.nav-link.active,
.nav-link.active.guide,
.nav-link.active.hub,
.chat-tool:hover,
.chat-send-icon:hover,
.chat-theme-toggle:hover {
  color: var(--custom-ink);
  border-color: var(--pf-chat-neon);
  background-color: var(--pf-chat-neon-soft);
}

body.is-chat-home .chat-root--home .chat-form {
  background: rgba(238, 238, 238, 0.72);
  background-image: none;
  border-color: var(--pf-chat-neon);
}

:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-form {
  background: rgba(21, 21, 21, 0.78);
  background-image: none;
}

body.is-chat-home .chat-root--home .chat-form textarea {
  color: var(--custom-ink);
}

body.is-chat-home .chat-root--home .chat-form textarea::placeholder {
  color: var(--custom-muted);
}

body.is-chat-home .chat-root--home .chat-form::before,
.chat-theme-toggle,
body.is-chat-home .chat-root--home .chat-tool,
body.is-chat-home .chat-root--home .chat-send-icon,
.nav-folder summary::before,
.chat-viewfinder-corner,
.chat-shutter-dot,
.chat-cursor,
.chat-bubble--typing .chat-cursor-inline {
  color: var(--pf-chat-neon);
  border-color: var(--pf-chat-neon);
}

body.is-chat-home .chat-root--home .chat-form::before,
.chat-shutter-dot,
.chat-cursor,
.chat-bubble--typing .chat-cursor-inline {
  background: var(--pf-chat-neon);
}

.nav-folder summary::before,
.nav-folder[open] summary::before {
  background:
    linear-gradient(135deg, transparent 48%, var(--pf-chat-neon) 49% 58%, transparent 59%) center / 0.42rem 0.42rem no-repeat,
    transparent;
}

/* Final composer cleanup */
body.is-chat-home .chat-root--home .chat-compose {
  background: transparent !important;
  background-color: transparent !important;
  border-top: 0 !important;
}

body.is-chat-home .chat-root--home .chat-form::before {
  display: none !important;
}

body.is-chat-home .chat-root--home .chat-form {
  align-items: center !important;
  grid-template-columns: 1.85rem 1.85rem minmax(0, 650px) 2.15rem !important;
  gap: 0.32rem !important;
  min-height: 3.05rem !important;
  padding: 0.32rem !important;
}

body.is-chat-home .chat-root--home .chat-tool--upload {
  grid-column: 1 !important;
}

body.is-chat-home .chat-root--home .chat-tool--target {
  grid-column: 2 !important;
}

body.is-chat-home .chat-root--home .chat-tool {
  align-self: center !important;
  justify-self: center !important;
  width: 1.85rem !important;
  min-width: 1.85rem !important;
  height: 1.85rem !important;
}

body.is-chat-home .chat-root--home .chat-form textarea {
  grid-column: 3 !important;
  font-size: 0.78rem !important;
  line-height: 1.35 !important;
  align-self: center !important;
  min-height: 2rem !important;
  height: 2rem !important;
  padding: 0.36rem 0.46rem !important;
}

body.is-chat-home .chat-root--home .chat-send-icon {
  grid-column: 4 !important;
  align-self: center !important;
  justify-self: center !important;
  width: 2.15rem !important;
  min-width: 2.15rem !important;
  max-width: 2.15rem !important;
  height: 2.15rem !important;
}

/* Last-word response polish */
body.is-chat-home,
body.is-chat-home .app,
body.is-chat-home .main,
body.is-chat-home .content,
body.is-chat-home .manual-home,
body.is-chat-home .chat-home-slot,
body.is-chat-home .chat-root--home,
body.is-chat-home .chat-root--home .chat-shell,
body.is-chat-home .chat-root--home .chat-body,
body.is-chat-home .chat-root--home .chat-layout,
body.is-chat-home .chat-root--home .chat-main,
body.is-chat-home .chat-root--home .chat-log {
  background: var(--pf-chat-surface) !important;
  background-image: none !important;
}

:root[data-manual-theme="dark"] body.is-chat-home,
:root[data-manual-theme="dark"] body.is-chat-home .app,
:root[data-manual-theme="dark"] body.is-chat-home .main,
:root[data-manual-theme="dark"] body.is-chat-home .content,
:root[data-manual-theme="dark"] body.is-chat-home .manual-home,
:root[data-manual-theme="dark"] body.is-chat-home .chat-home-slot,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-shell,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-body,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-layout,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-main,
:root[data-manual-theme="dark"] body.is-chat-home .chat-root--home .chat-log {
  background: #101010 !important;
  background-image: none !important;
}

body.is-chat-home .chat-root--home .chat-log {
  padding: 1.2rem 1.35rem 7.25rem !important;
}

body.is-chat-home .chat-root--home .chat-bubble {
  max-width: min(650px, 100%) !important;
  padding: 0.76rem 0.86rem !important;
  border-radius: 6px !important;
  font-size: 0.76rem !important;
  line-height: 1.52 !important;
  letter-spacing: 0 !important;
  box-shadow: none !important;
}

body.is-chat-home .chat-root--home .chat-bubble--assistant,
body.is-chat-home .chat-root--home .chat-bubble--user {
  background: var(--custom-panel) !important;
  color: var(--custom-copy) !important;
  border: 1px solid var(--custom-line) !important;
}

body.is-chat-home .chat-root--home .chat-bubble--user {
  color: var(--custom-ink) !important;
  border-color: var(--pf-chat-neon) !important;
}

body.is-chat-home .chat-root--home .chat-bubble--assistant .chat-answer-title {
  margin: 0 0 0.46rem !important;
  color: var(--custom-ink) !important;
  font-size: 1rem !important;
  line-height: 1.2 !important;
}

body.is-chat-home .chat-root--home .chat-bubble p,
body.is-chat-home .chat-root--home .chat-bubble li {
  color: var(--custom-copy) !important;
  font-size: inherit !important;
}

body.is-chat-home .chat-root--home .chat-bubble strong {
  color: var(--custom-ink) !important;
}

body.is-chat-home .chat-root--home .chat-media {
  max-width: 650px !important;
}

body.is-chat-home .chat-root--home .chat-media-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(108px, 138px)) !important;
  gap: 0.38rem !important;
  width: fit-content !important;
  max-width: 100% !important;
}

body.is-chat-home .chat-root--home .chat-figure {
  overflow: hidden !important;
  border: 1px solid var(--custom-line) !important;
  border-radius: 6px !important;
  background: var(--custom-panel) !important;
  box-shadow: none !important;
}

body.is-chat-home .chat-root--home .chat-figure img {
  display: block !important;
  width: 100% !important;
  height: 82px !important;
  max-height: 82px !important;
  object-fit: cover !important;
  background: var(--pf-chat-surface) !important;
}

body.is-chat-home .chat-root--home .chat-figure-link,
body.is-chat-home .chat-root--home .chat-source {
  border-radius: 6px !important;
  background: var(--custom-panel) !important;
  color: var(--custom-copy) !important;
  border-color: var(--custom-line) !important;
}

body.is-chat-home .chat-root--home .chat-figure-link {
  min-height: 1.32rem !important;
  margin: 0.24rem !important;
  padding: 0.2rem 0.36rem !important;
  font-size: 0.52rem !important;
  line-height: 1 !important;
}


/* Agent Mode status-board reply structure */
body.is-chat-home .chat-root--home .chat-bubble--assistant .chat-md-h2 {
  margin: 0.75rem 0 0.28rem !important;
  color: var(--pf-chat-neon) !important;
  font-size: 0.68rem !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
}

body.is-chat-home .chat-root--home .chat-bubble--assistant .chat-md-h3 {
  margin: 0.65rem 0 0.25rem !important;
  color: var(--custom-ink) !important;
  font-size: 0.78rem !important;
}

body.is-chat-home .chat-root--home .chat-bubble--assistant .chat-md-quote {
  margin: 0 0 0.5rem !important;
  padding: 0.4rem 0.55rem !important;
  border-left: 2px solid var(--pf-chat-neon) !important;
  background: color-mix(in srgb, var(--pf-chat-neon) 8%, transparent) !important;
}

body.is-chat-home .chat-root--home .chat-bubble--assistant .chat-md-list {
  margin: 0 0 0.45rem !important;
  padding-left: 1rem !important;
}

body.is-chat-home .chat-root--home .chat-bubble--assistant code {
  font-size: 0.78em !important;
  padding: 0.05em 0.3em !important;
  border-radius: 3px !important;
  background: color-mix(in srgb, var(--pf-chat-neon) 12%, transparent) !important;
  border: 1px solid color-mix(in srgb, var(--pf-chat-neon) 35%, transparent) !important;
}

/* Pending Approve / Send card (CLI harness writes) */
.pending-approval-card {
  margin: 0.55rem 0 0.35rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid color-mix(in srgb, var(--pf-chat-neon, #6cf) 45%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--pf-chat-neon, #6cf) 8%, transparent);
}
.pending-approval-card__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.pending-approval-card__kind {
  font-size: 0.7rem;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pending-approval-card__summary {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  line-height: 1.35;
}
.pending-approval-card__actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.pending-approval-card__approve,
.pending-approval-card__cancel {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.pending-approval-card__approve {
  background: color-mix(in srgb, var(--pf-chat-neon, #6cf) 55%, #111);
  color: #041018;
  border-color: color-mix(in srgb, var(--pf-chat-neon, #6cf) 70%, transparent);
}
.pending-approval-card__cancel {
  background: transparent;
  color: inherit;
  border-color: color-mix(in srgb, currentColor 35%, transparent);
}
.pending-approval-card__hint {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  opacity: 0.7;
}
.pending-approval-card.is-done {
  opacity: 0.85;
  border-color: color-mix(in srgb, #6d6 50%, transparent);
}
.pending-approval-card.is-cancelled {
  opacity: 0.55;
}

/* Insert prepare: approval is the only surface (no mini design studio) */
.chat-turn.is-insert-approval-turn .chat-media {
  display: none !important;
}
.chat-turn.is-insert-approval-turn .chat-tool.is-insert-approval-only {
  display: block !important;
  margin-top: 0.35rem;
}
.pending-approval-card--insert {
  margin: 0.4rem 0 0.6rem;
  padding: 1rem 1.05rem;
  max-width: min(28rem, 100%);
  border: 1px solid #0099ff;
  border-radius: 10px;
  background: #1a1a1a;
  box-shadow: 0 0 0 1px rgba(0, 153, 255, 0.25), 0 12px 28px rgba(0, 0, 0, 0.35);
  color: #f2f2f2;
}
.pending-approval-card--insert .pending-approval-card__head strong {
  font-size: 1rem;
  color: #ffffff;
}
.pending-approval-card--insert .pending-approval-card__kind {
  color: #0099ff;
  opacity: 1;
}
.pending-approval-card--insert .pending-approval-card__summary {
  font-size: 0.92rem;
  color: #dddddd;
}
.pending-approval-card--insert .pending-approval-card__approve {
  min-height: 2.2rem;
  padding: 0.45rem 1rem;
  background: #0099ff;
  color: #ffffff;
  border-color: #0099ff;
  font-weight: 700;
}
.pending-approval-card--insert .pending-approval-card__approve:hover {
  background: #33adff;
}
.pending-approval-card--insert .pending-approval-card__cancel {
  min-height: 2.2rem;
  color: #cccccc;
  border-color: #444444;
}
.chat-insert-approval-lead {
  font-size: 0.85rem;
  opacity: 0.78;
}

/* Design Studio — canvas icon next to Chat label in main-top */
.main-top-title-row {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  min-width: 0 !important;
}

body.is-chat-home .main-top,
body.is-chat-home.is-sidebar-collapsed .main-top {
  padding-left: 0.5rem !important;
}

body.is-chat-home .main-top-title-row {
  gap: 0.32rem !important;
}

.main-top .chat-header-tool {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 1.55rem !important;
  min-width: 1.55rem !important;
  height: 1.55rem !important;
  min-height: 1.55rem !important;
  padding: 0 !important;
  border: 1px solid color-mix(in srgb, currentColor 28%, transparent) !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: #c8c8c8 !important;
  cursor: pointer !important;
  box-shadow: none !important;
  flex: 0 0 auto !important;
}

body.is-chat-home #chat-input:focus,
body.is-chat-home #chat-input:focus-visible,
#chat-root #chat-input:focus,
#chat-root #chat-input:focus-visible {
  outline: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.chat-seo-check {
  grid-template-columns: auto minmax(0, 1fr) auto auto !important;
}

.chat-seo-check-edit {
  min-width: 2.75rem;
  min-height: 1.65rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid color-mix(in srgb, #38a9f5 45%, #555);
  border-radius: 4px;
  background: transparent;
  color: #b9dcf5;
  font: 700 0.68rem/1 system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.chat-seo-check-edit:hover,
.chat-seo-check-edit:focus-visible {
  color: #fff;
  border-color: #38a9f5;
  background: color-mix(in srgb, #38a9f5 18%, transparent);
  outline: none;
}

.main-top .chat-header-tool:hover,
.main-top .chat-header-tool:focus-visible {
  color: #fff !important;
  background: #0099ff !important;
  border-color: #0099ff !important;
  outline: none !important;
}

.chat-header-menu-icon {
  position: relative;
  width: 0.78rem;
  height: 0.62rem;
  border: 1.5px solid currentColor;
  border-radius: 1.5px;
  box-sizing: border-box;
}

.chat-header-menu-icon::before {
  content: "";
  position: absolute;
  inset: 1.5px auto 1.5px 2px;
  width: 2px;
  border-right: 1.5px solid currentColor;
}

body:not(.is-sidebar-collapsed) .chat-header-menu-icon::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  width: 3px;
  height: 3px;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}

.chat-header-seo-icon {
  position: relative;
  width: 0.72rem;
  height: 0.82rem;
  border: 1.5px solid currentColor;
  border-radius: 1.5px;
  box-sizing: border-box;
}

.chat-header-seo-icon::before {
  content: "✓";
  position: absolute;
  left: 1px;
  top: -3px;
  font: 700 8px/1 system-ui, sans-serif;
}

.chat-header-seo-icon::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 1px;
  top: 3px;
  height: 1px;
  background: currentColor;
  box-shadow: 0 3px 0 currentColor;
}

.main-top .chat-open-studio.chat-open-studio--icon,
#chat-open-studio.chat-open-studio--icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 1.55rem !important;
  min-width: 1.55rem !important;
  height: 1.55rem !important;
  min-height: 1.55rem !important;
  padding: 0 !important;
  border: 1px solid color-mix(in srgb, #0099ff 55%, #3a3a3a) !important;
  border-radius: 5px !important;
  background: transparent !important;
  color: #c8c8c8 !important;
  cursor: pointer !important;
  box-shadow: none !important;
  flex: 0 0 auto !important;
  line-height: 0 !important;
}

.main-top .chat-open-studio.chat-open-studio--icon:hover,
.main-top .chat-open-studio.chat-open-studio--icon:focus-visible,
#chat-open-studio.chat-open-studio--icon:hover,
#chat-open-studio.chat-open-studio--icon:focus-visible {
  background: #0099ff !important;
  border-color: #0099ff !important;
  color: #ffffff !important;
  outline: none !important;
}

/* Canvas / artboard glyph */
.main-top .chat-open-studio-icon,
#chat-open-studio .chat-open-studio-icon {
  display: block !important;
  width: 0.78rem !important;
  height: 0.62rem !important;
  border: 1.5px solid currentColor !important;
  border-radius: 1.5px !important;
  position: relative !important;
  box-sizing: border-box !important;
  flex: 0 0 auto !important;
  background: transparent !important;
}

.main-top .chat-open-studio-icon::before,
#chat-open-studio .chat-open-studio-icon::before {
  content: "" !important;
  position: absolute !important;
  left: 1.5px !important;
  right: 1.5px !important;
  top: 2px !important;
  height: 1.25px !important;
  background: currentColor !important;
  opacity: 0.9 !important;
}

.main-top .chat-open-studio-icon::after,
#chat-open-studio .chat-open-studio-icon::after {
  content: "" !important;
  position: absolute !important;
  left: 1.5px !important;
  width: 45% !important;
  bottom: 2px !important;
  height: 1.25px !important;
  background: currentColor !important;
  opacity: 0.75 !important;
}

/* Legacy in-chat studio bar (removed from markup) */
#chat-root .chat-studio-bar,
body.is-chat-home .chat-root--home .chat-studio-bar {
  display: none !important;
}

/* Hide studio launcher while fullscreen studio is open */
body.is-block-draft-fullscreen #chat-open-studio {
  display: none !important;
}

/* Compose dock behind input — never a full-width dark strip */
body.is-chat-home .chat-root--home .chat-compose,
#chat-root .chat-compose {
  background: transparent !important;
  background-image: none !important;
  border-top: 0 !important;
  box-shadow: none !important;
}

/* After insert resolve — shrink card so chat can move on */
.pending-approval-card.is-collapsed-after-insert,
.chat-turn.is-insert-resolved .pending-approval-card {
  opacity: 0.72;
  max-height: 4.5rem;
  overflow: hidden;
  padding: 0.55rem 0.75rem !important;
  transition: opacity 0.25s ease, max-height 0.35s ease;
}
.pending-approval-card.is-collapsed-after-insert .pending-approval-card__hint,
.pending-approval-card.is-done .pending-approval-card__hint,
.pending-approval-card.is-cancelled .pending-approval-card__hint {
  display: none;
}
.pending-approval-card__dismiss {
  min-height: 2.2rem;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid #444444;
  background: #2a2a2a;
  color: #eeeeee;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.pending-approval-card__dismiss:hover {
  border-color: #0099ff;
  color: #ffffff;
}
.pending-approval-card--insert .pending-approval-card__dismiss {
  background: #222222;
}
/* Composer free after insert (not stuck in editor-compose mode) */
#chat-root .chat-compose:not(.is-editor-compose) {
  pointer-events: auto;
}
