/* Pod Chat: operational conversation surface */
.pod-chat-page {
  --pod-chat-content-width: 780px;
  height: 100dvh;
  overflow: hidden;
  background: var(--warm-cream);
  font-family: Urbanist, sans-serif;
}

.pod-chat-page button,
.pod-chat-page textarea,
.pod-chat-page input {
  font-family: Urbanist, sans-serif;
}

.pod-chat-page .dashboard-layout {
  gap: 0;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.main-content.pod-chat-workspace {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.pod-chat-header {
  flex: 0 0 auto;
  width: 100%;
  min-height: 82px;
  padding: 19px 24px 12px;
  box-sizing: border-box;
}

.pod-chat-header-inner {
  display: flex;
  width: min(var(--pod-chat-content-width), 100%);
  min-width: 0;
  margin: 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.pod-chat-title {
  min-width: 0;
}

.pod-chat-header h1 {
  margin: 0;
  color: #183c2b;
}

.pod-chat-header p {
  margin: 3px 0 0;
  color: #59645e;
  font-size: 0.95rem;
}

.pod-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pod-chat-history-toggle,
.pod-chat-new,
.pod-chat-retry {
  min-height: 44px;
  padding: 8px 4px;
  border: 0;
  color: #315c48;
  background: transparent;
  font: inherit;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.pod-chat-history-toggle {
  display: inline-grid;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border-radius: 8px;
}

.pod-chat-history-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.pod-chat-history-toggle:hover,
.pod-chat-new:hover,
.pod-chat-retry:hover {
  color: #123c29;
}

.pod-chat-history-toggle:hover {
  background: #eceae3;
}

.pod-chat-continuation {
  padding: 12px 16px;
  margin: 12px 0;
  border-left: 3px solid #315c48;
  border-radius: 6px;
  background: #ecefe8;
  overflow-wrap: anywhere;
}

.pod-chat-continuation p {
  margin: 0;
}

.pod-chat-shell {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: var(--warm-cream);
}

.pod-chat-history-rail {
  position: relative;
  display: flex;
  flex: 0 0 56px;
  flex-direction: column;
  width: 56px;
  min-height: 0;
  background: #efede6;
  border-right: 1px solid rgba(24, 60, 43, 0.06);
  overflow: hidden;
  transition:
    flex-basis 180ms var(--ease-ui-move),
    width 180ms var(--ease-ui-move);
}

.pod-chat-history-open .pod-chat-history-rail {
  flex-basis: 250px;
  width: 250px;
}

.pod-chat-history-toolbar {
  position: relative;
  flex: 0 0 56px;
  height: 56px;
}

.pod-chat-history-toolbar .pod-chat-history-toggle {
  position: absolute;
  top: 6px;
  left: 6px;
}

.pod-chat-history {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 250px;
  min-height: 0;
  padding: 8px 18px 18px;
  box-sizing: border-box;
  overflow: hidden;
  visibility: hidden;
}

.pod-chat-history-open .pod-chat-history {
  visibility: visible;
}

.pod-chat-history-header {
  margin-bottom: 16px;
}

.pod-chat-history-header h2 {
  margin: 0;
  color: #234737;
  font-size: 1rem;
}

.pod-chat-history-more {
  min-height: 44px;
  padding: 8px;
  border: 0;
  color: #315c48;
  background: transparent;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.pod-chat-history-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
  padding: 2px;
}

.pod-chat-history-entry {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: start;
  border-radius: 6px;
  color: #355044;
}

.pod-chat-history-entry:hover,
.pod-chat-history-entry.is-current {
  color: #173c2b;
  background: #e1dfd6;
}

.pod-chat-history-item {
  min-width: 0;
  min-height: 52px;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.pod-chat-history-actions-toggle {
  width: 44px;
  min-width: 44px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition:
    color 140ms ease,
    background-color 140ms ease;
}

.pod-chat-history-actions-toggle:hover {
  color: #173c2b;
  background: transparent;
}

.pod-chat-history-menu {
  position: absolute;
  z-index: 8;
  top: 44px;
  right: 4px;
  display: grid;
  width: 132px;
  padding: 4px;
  border: 1px solid rgba(28, 62, 46, 0.12);
  border-radius: 10px;
  background: #fbfaf6;
  box-shadow: 0 5px 12px rgba(26, 53, 40, 0.1);
  transform-origin: top right;
  transition:
    opacity 150ms var(--ease-ui-out),
    transform 150ms var(--ease-ui-out);

  @starting-style {
    opacity: 0.5;
    transform: translateY(-4px);
  }
}

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

.pod-chat-history-menu button {
  width: 100%;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 8px 10px;
  box-sizing: border-box;
  border: 0;
  border-radius: 7px;
  color: #315c48;
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  transition:
    color 130ms ease,
    background-color 130ms ease;
}

.pod-chat-history-menu button:hover {
  color: #173c2b;
  background: #eeece5;
}

.pod-chat-history-menu button[data-chat-history-delete] {
  color: #87453d;
}

.pod-chat-history-item strong,
.pod-chat-history-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pod-chat-load-earlier {
  display: block;
  min-height: 44px;
  margin: 0 auto 18px;
  padding: 8px 12px;
  border: 0;
  color: #315c48;
  background: transparent;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.pod-chat-history-item strong {
  font-size: 0.88rem;
  font-weight: 650;
}

.pod-chat-history-item span {
  margin-top: 3px;
  color: #69716d;
  font-size: 0.74rem;
}

.pod-chat-history-empty {
  margin: 10px;
  color: #69716d;
  font-size: 0.84rem;
  line-height: 1.45;
}

.pod-chat-history-backdrop {
  display: none;
}

.pod-chat-stage {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  margin: 0;
  background: transparent;
}

.pod-chat-transcript {
  flex: 1;
  min-height: 0;
  padding: 10px 24px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pod-chat-intro {
  display: grid;
  width: min(var(--pod-chat-content-width), 100%);
  min-height: 100%;
  margin: 0 auto;
  align-content: center;
  padding: 24px 0 40px;
  box-sizing: border-box;
}

.pod-chat-intro > img {
  display: block;
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  object-fit: contain;
}

.pod-chat-intro h2 {
  margin: 0;
  color: #21352c;
  font-family: "Urbanist", sans-serif;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  line-height: 1.15;
}

.pod-chat-intro > p {
  max-width: 610px;
  margin: 9px 0 22px;
  color: #58635d;
  line-height: 1.55;
}

.pod-chat-suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-width: 680px;
}

.pod-chat-suggestions button {
  min-height: 46px;
  padding: 11px 13px;
  border: 0;
  border-radius: 10px;
  color: #244737;
  background: #edf1eb;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 620;
  text-align: left;
  cursor: pointer;
  transition:
    background-color 150ms ease,
    color 150ms ease;
}

.pod-chat-suggestions button:hover {
  color: #133c29;
  background: #e2e9e1;
}

.pod-chat-message {
  width: min(var(--pod-chat-content-width), 100%);
  max-width: var(--pod-chat-content-width);
  margin: 0 auto 24px;
}

.pod-chat-message--with-table {
  width: 100%;
  max-width: none;
}

.pod-chat-message--with-table > .pod-chat-speaker,
.pod-chat-message--with-table > .pod-chat-message-body,
.pod-chat-message--with-table > .pod-chat-sources,
.pod-chat-message--with-table > .pod-chat-retry {
  width: min(var(--pod-chat-content-width), 100%);
  margin-right: auto;
  margin-left: auto;
  box-sizing: border-box;
}

.pod-chat-message--user {
  width: fit-content;
  max-width: min(560px, 82%);
  margin-right: max(0px, calc((100% - var(--pod-chat-content-width)) / 2));
  margin-left: auto;
  padding: 12px 15px;
  border-radius: 13px 13px 4px 13px;
  color: #f8fff9;
  background: #1f6747;
}

.pod-chat-message--user .pod-chat-speaker {
  color: rgba(255, 255, 255, 0.72);
}

.pod-chat-speaker--user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pod-chat-speaker-avatar--user {
  border-radius: 50%;
  background: #e9e4d8;
}

.pod-chat-message--error {
  color: #7a2f2f;
}

.pod-chat-speaker {
  margin: 0 0 5px;
  color: #47715d;
  font-size: 0.76rem;
  font-weight: 750;
}

.pod-chat-speaker--nuggy {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
}

.pod-chat-speaker-avatar {
  display: block;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  object-fit: contain;
}

.pod-chat-message-body {
  color: inherit;
  font-family: Urbanist, sans-serif;
  font-size: 1.02rem;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.pod-chat-typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 28px;
  min-height: 20px;
}

.pod-chat-typing-indicator span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #47715d;
  animation: pod-chat-typing 780ms ease-in-out infinite alternate;
}

.pod-chat-typing-indicator span:nth-child(2) {
  animation-delay: 100ms;
}

.pod-chat-typing-indicator span:nth-child(3) {
  animation-delay: 200ms;
}

@keyframes pod-chat-typing {
  from {
    opacity: 0.32;
    transform: translateY(1px);
  }
  to {
    opacity: 1;
    transform: translateY(-1px);
  }
}

.pod-chat-sources {
  margin: 9px 0 0;
  color: var(--graphite-70);
  font-size: 0.76rem;
}

.pod-chat-sources a {
  color: var(--primary-green);
  font-weight: 650;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.pod-chat-sources a:hover {
  color: var(--deep-forest);
}

.pod-chat-table-card {
  margin-top: 16px;
  border: 1px solid rgba(24, 60, 43, 0.12);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(24, 60, 43, 0.06);
  overflow: visible;
}

.pod-chat-table-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(24, 60, 43, 0.09);
}

.pod-chat-table-header h3 {
  display: block;
  margin: 0;
  color: #183c2b;
  font-size: 1rem;
}

.pod-chat-table-header p:not(.pod-chat-table-status) {
  margin: 3px 0 0;
  color: #65726b;
  font-size: 0.78rem;
}

.pod-chat-table-export {
  flex: 0 0 auto;
}

.pod-chat-table-export .table-export-trigger {
  min-height: 40px;
}

.pod-chat-table-scroll {
  position: relative;
  z-index: 1;
  max-width: 100%;
  overflow-x: auto;
  border-radius: 0 0 14px 14px;
}

.pod-chat-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  font-size: 0.84rem;
}

.pod-chat-table th,
.pod-chat-table td {
  min-width: max-content;
  padding: 10px 12px;
  white-space: nowrap;
}

.pod-chat-table td {
  color: #35483f;
}

.pod-chat-table-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid rgba(24, 60, 43, 0.09);
  color: #65726b;
  font-size: 0.82rem;
}

.pod-chat-table-pagination .btn {
  min-height: 36px;
  padding: 6px 12px;
}

.pod-chat-table-pagination .btn:disabled {
  cursor: default;
  opacity: 0.45;
}

.pod-chat-table-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 3px 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.pod-chat-table th.sort-asc .pod-chat-table-sort::after {
  content: "↑";
  color: var(--primary-green);
}

.pod-chat-table th.sort-desc .pod-chat-table-sort::after {
  content: "↓";
  color: var(--primary-green);
}

.pod-chat-table-sort:focus-visible,
.pod-chat-table-scroll:focus-visible,
.pod-chat-table-export .table-export-trigger:focus-visible,
.pod-chat-table-export .table-export-option:focus-visible {
  outline: 3px solid rgba(57, 119, 90, 0.16);
  outline-offset: 2px;
}

.pod-chat-composer {
  flex: 0 0 auto;
  width: min(var(--pod-chat-content-width), calc(100% - 48px));
  margin: 0 auto;
  padding: 8px 0 14px;
  background: transparent;
}

.pod-chat-composer > label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pod-chat-composer-row {
  position: relative;
  min-height: 58px;
  padding: 7px;
  border: 1px solid rgba(32, 69, 51, 0.18);
  border-radius: 20px;
  background: #fffefa;
  box-sizing: border-box;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.pod-chat-composer-row:focus-within {
  border-color: #39775a;
  box-shadow: 0 0 0 3px rgba(57, 119, 90, 0.1);
}

.pod-chat-composer textarea {
  display: block;
  width: 100%;
  min-height: 42px;
  max-height: 140px;
  padding: 10px 58px 9px 12px;
  box-sizing: border-box;
  overflow-y: auto;
  resize: none;
  border: 0;
  border-radius: 14px;
  color: #25372e;
  outline: 0;
  background: transparent;
  font: inherit;
  line-height: 1.4;
}

.pod-chat-suggestions button:active,
.pod-chat-new:active,
.pod-chat-retry:active,
.pod-chat-composer button[type="submit"]:active {
  opacity: 0.78;
}

.pod-chat-suggestions button:focus-visible,
.pod-chat-history-item:focus-visible,
.pod-chat-history-actions-toggle:focus-visible,
.pod-chat-history-menu button:focus-visible,
.pod-chat-history-more:focus-visible,
.pod-chat-history-toggle:focus-visible,
.pod-chat-new:focus-visible,
.pod-chat-retry:focus-visible,
.pod-chat-load-earlier:focus-visible,
.pod-chat-sources a:focus-visible,
.pod-chat-scroll-bottom:focus-visible,
.pod-chat-composer button[type="submit"]:focus-visible {
  outline: 3px solid rgba(57, 119, 90, 0.16);
  outline-offset: 2px;
}

.pod-chat-composer button[type="submit"] {
  position: absolute;
  right: 7px;
  bottom: 7px;
  display: grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: #225f43;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.pod-chat-composer button[type="submit"] svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.pod-chat-composer button[type="submit"]:hover {
  background: #174c34;
}

.pod-chat-composer button[type="submit"]:disabled {
  color: #d6e0da;
  background: #668274;
  cursor: wait;
}

.pod-chat-composer-note {
  margin: 7px 10px 0;
  color: #68736d;
  font-size: 0.74rem;
  line-height: 1.3;
}

.pod-chat-scroll-bottom {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 90px;
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  transform: translateX(-50%);
  border: 1px solid rgba(32, 69, 51, 0.16);
  border-radius: 50%;
  color: #315c48;
  background: #fffefa;
  cursor: pointer;
  transition:
    opacity 150ms var(--ease-ui-out),
    transform 150ms var(--ease-ui-out),
    background-color 150ms ease,
    color 150ms ease;

  @starting-style {
    opacity: 0.5;
    transform: translate(-50%, 7px) scale(0.96);
  }
}

.pod-chat-scroll-bottom[hidden] {
  display: none;
}

.pod-chat-scroll-bottom svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.pod-chat-scroll-bottom:hover {
  color: #123c29;
  background: #f3f1ea;
}

.pod-chat-unavailable {
  width: min(620px, 100%);
  margin: auto;
  padding: 42px;
  text-align: center;
}

.pod-chat-unavailable h1 {
  color: #183c2b;
}

.pod-chat-unavailable a {
  display: inline-block;
  min-height: 44px;
  margin-top: 8px;
  padding: 11px 16px;
  border-radius: 7px;
  color: white;
  background: #225f43;
  text-decoration: none;
}

@media (max-width: 1024px) {
  .main-content.pod-chat-workspace {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    padding: 0;
  }

  .pod-chat-history-rail {
    position: absolute;
    z-index: 42;
    inset: 0 auto 0 0;
    width: 44px;
    flex-basis: auto;
    box-sizing: border-box;
    background: transparent;
    overflow: visible;
    transition:
      width 180ms var(--ease-ui-move),
      background-color 180ms var(--ease-ui-move);
  }

  .pod-chat-history-open .pod-chat-history-rail {
    width: min(320px, 88vw);
    background: #eeece4;
    overflow: hidden;
  }

  .pod-chat-history-toolbar {
    flex-basis: 44px;
    height: 44px;
  }

  .pod-chat-history-toolbar .pod-chat-history-toggle {
    top: 0;
    left: 0;
  }

  .pod-chat-history {
    width: min(320px, 88vw);
  }

  .pod-chat-history-backdrop:not([hidden]) {
    position: absolute;
    z-index: 41;
    inset: 0;
    display: block;
    width: 100%;
    border: 0;
    background: rgba(24, 40, 32, 0.34);
  }
}

@media (max-width: 620px) {
  .pod-chat-workspace {
    padding: 0;
  }

  .pod-chat-header {
    min-height: 76px;
    padding: 10px 14px 8px 58px;
  }

  .pod-chat-header-actions {
    justify-content: flex-end;
    gap: 8px;
  }

  .pod-chat-new,
  .pod-chat-history-toggle {
    min-width: 44px;
    font-size: 0.78rem;
  }

  .pod-chat-header p {
    max-width: 230px;
    font-size: 0.82rem;
  }

  .pod-chat-stage {
    min-width: 0;
  }

  .pod-chat-transcript {
    padding: 8px 16px 16px;
  }

  .pod-chat-intro {
    padding: 20px 0 28px;
  }

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

  .pod-chat-composer {
    width: calc(100% - 28px);
    padding: 6px 0 calc(10px + env(safe-area-inset-bottom));
  }

  .pod-chat-composer button[type="submit"] {
    min-width: 44px;
    padding: 0;
  }

  .pod-chat-composer-note {
    display: none;
  }

  .pod-chat-scroll-bottom {
    bottom: 82px;
  }

  .pod-chat-table-header {
    align-items: stretch;
    flex-direction: column;
  }

  .pod-chat-table-export,
  .pod-chat-table-export .table-export-trigger {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pod-chat-history-rail,
  .pod-chat-history,
  .pod-chat-suggestions button,
  .pod-chat-composer button[type="submit"],
  .pod-chat-new,
  .pod-chat-retry {
    transition: none;
  }

  .pod-chat-history-menu,
  .pod-chat-scroll-bottom {
    transition: none;
  }

  .pod-chat-typing-indicator span {
    animation: none;
    opacity: 0.72;
    transform: none;
  }

  .pod-chat-suggestions button:active,
  .pod-chat-new:active,
  .pod-chat-retry:active,
  .pod-chat-composer button[type="submit"]:active {
    transform: none;
  }
}

/* Chat keeps Help beside New chat so it cannot cover the growing composer. */
.pod-chat-header-actions #feedback-widget-root {
  flex: 0 0 44px;
  width: 44px;
}

.pod-chat-header-actions .feedback-fab-group {
  --fab-toggle-size: 44px;
  position: relative;
  inset: auto;
  max-width: none;
  z-index: 40;
}

.pod-chat-header-actions .feedback-fab-toggle {
  border: 1px solid var(--graphite-10);
  border-radius: 8px;
  background: transparent;
  color: var(--deep-forest);
  box-shadow: none;
}

.pod-chat-header-actions .feedback-fab-toggle svg {
  width: 24px;
  height: 24px;
}

.pod-chat-header-actions .feedback-fab-actions {
  top: calc(var(--fab-toggle-size) + 8px);
  bottom: auto;
  transform-origin: top right;
}

@media (min-width: 1025px) {
  /* Chat owns its content spacing and meets the navigation edge. */
  .dashboard-content-document body.pod-chat-page .dashboard-layout {
    padding-left: 0;
    padding-right: 0;
  }
}
