:root {
  color: #1b211f;
  background: #f4f6f5;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-synthesis: none;
  --ink: #1b211f;
  --muted: #67716d;
  --line: #dfe4e1;
  --soft: #f4f6f5;
  --panel: #ffffff;
  --nav: #18211e;
  --nav-muted: #9eaaa5;
  --green: #247452;
  --green-soft: #e8f3ed;
  --amber: #a76616;
  --amber-soft: #fff3df;
  --red: #a13b38;
  --red-soft: #fae9e8;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.workspace {
  display: grid;
  grid-template-columns: 244px minmax(420px, 1fr) 320px;
  height: 100dvh;
  min-height: 0;
  background: var(--panel);
}

.navigation {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: 22px 16px 18px;
  color: #f4f7f5;
  background: var(--nav);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
  font-size: 16px;
  font-weight: 700;
}

.brand-dark {
  padding: 0;
  color: var(--ink);
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #52605a;
  border-radius: 6px;
  color: #eaf5ef;
  background: #26332f;
  font-family: Georgia, serif;
  font-size: 17px;
}

.brand-dark .brand-mark {
  border-color: #303a36;
}

.new-chat-button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  padding: 0 12px;
  border: 1px solid #45514c;
  border-radius: 6px;
  color: #f5f7f6;
  background: #25302c;
  font-weight: 650;
  text-align: left;
}

.new-chat-button:hover {
  background: #303c37;
}

.new-chat-button span {
  font-size: 20px;
  font-weight: 400;
}

.nav-list {
  margin-top: 30px;
}

.nav-label,
.section-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-label {
  padding: 0 10px 8px;
  color: var(--nav-muted);
}

.nav-item {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  color: #d8dfdc;
  background: transparent;
  text-align: left;
}

.nav-item > span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-count {
  min-width: 18px;
  margin-left: auto;
  color: #c8d2ce;
  font-size: 11px;
  text-align: right;
}

.nav-item.active {
  color: #ffffff;
  background: #2a3732;
}

.knowledge-nav-icon {
  color: #d5a24f;
  font-size: 7px;
}

.opportunities-nav-icon {
  color: #6bb28f;
  font-size: 8px;
}

.nav-icon {
  color: #66b68e;
  font-size: 9px;
}

.account-block {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 6px 0;
  border-top: 1px solid #34413c;
}

.account-block strong,
.account-block span {
  display: block;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-block strong {
  font-size: 13px;
}

.account-block span {
  margin-top: 4px;
  color: var(--nav-muted);
  font-size: 12px;
}

.text-button {
  padding: 2px;
  border: 0;
  color: #b8c2be;
  background: transparent;
  font-size: 12px;
}

.text-button:hover {
  color: #ffffff;
}

.conversation {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 74px minmax(0, 1fr) auto;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--line);
}

.conversation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.conversation-header h1,
.context-header h2,
.empty-conversation h2,
.sign-in-panel h1 {
  margin: 0;
  letter-spacing: 0;
}

.conversation-header h1 {
  font-size: 18px;
}

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

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.connection-status span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3e9a6d;
}

.connection-status.busy span {
  background: #c9852d;
}

.icon-button {
  display: inline-grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #4d5854;
  background: #ffffff;
  font-size: 17px;
}

.icon-button:hover {
  border-color: #bac3bf;
  background: var(--soft);
}

#contextButton {
  display: none;
}

.chat-log {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 30px clamp(22px, 6vw, 86px) 150px;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

.empty-conversation {
  position: absolute;
  top: 43%;
  left: 50%;
  width: min(560px, calc(100% - 50px));
  transform: translate(-50%, -50%);
  text-align: center;
}

.empty-conversation h2 {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 650;
}

.suggestion-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 26px;
}

.suggestion {
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #3d4743;
  background: #ffffff;
  font-size: 13px;
  text-align: left;
}

.suggestion:hover {
  border-color: #aebbb5;
  background: var(--soft);
}

.message {
  width: min(760px, 100%);
  margin: 0 auto 28px;
}

.message-role {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.message-role-mark {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 5px;
  color: #ffffff;
  background: var(--green);
  font-family: Georgia, serif;
  font-size: 12px;
}

.message.user .message-role-mark {
  color: #4c5652;
  background: #e4e9e6;
  font-family: inherit;
}

.message-content {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #29312e;
  font-size: 15px;
  line-height: 1.65;
}

.message-content p {
  margin: 0 0 12px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content ul,
.message-content ol {
  margin: 8px 0 14px;
  padding-left: 22px;
}

.message-content a {
  color: #176746;
  text-underline-offset: 2px;
}

.message-content code {
  padding: 2px 4px;
  border-radius: 3px;
  background: #eef1ef;
  font-size: 13px;
}

.message-meta {
  display: inline-flex;
  margin-top: 10px;
  padding: 3px 7px;
  border-radius: 4px;
  color: #52615b;
  background: var(--green-soft);
  font-size: 11px;
}

.composer {
  position: absolute;
  bottom: 22px;
  left: 50%;
  display: flex;
  width: min(760px, calc(100% - 44px));
  min-height: 58px;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 10px 10px 16px;
  transform: translateX(-50%);
  border: 1px solid #cbd3cf;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(26, 38, 33, 0.09);
}

.composer:focus-within {
  border-color: #6c9f87;
  box-shadow: 0 10px 30px rgba(26, 38, 33, 0.09), 0 0 0 3px #e3eee8;
}

.composer textarea {
  width: 100%;
  max-height: 150px;
  min-height: 36px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  line-height: 1.45;
}

.composer textarea::placeholder {
  color: #8b9591;
}

.send-button {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  background: var(--green);
  font-size: 20px;
}

.send-button:hover {
  background: #1d6546;
}

.send-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.context-panel {
  min-width: 0;
  overflow-y: auto;
  background: #fafbfa;
}

.knowledge-view {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.opportunities-view {
  min-width: 0;
  height: 100dvh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.opportunities-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.opportunities-header h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.opportunities-body {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 36px 34px 70px;
}

.opportunities-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.opportunities-toolbar h2 {
  margin: 5px 0 0;
  font-size: 20px;
  letter-spacing: 0;
}

.opportunities-list {
  margin-top: 4px;
}

.opportunity-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid #e5eae7;
}

.opportunity-main {
  min-width: 0;
}

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

.opportunity-heading h3 {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: #29332f;
  font-size: 15px;
  letter-spacing: 0;
}

.opportunity-score {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 4px;
  color: #176746;
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 700;
}

.opportunity-score.unscored {
  color: #64706b;
  background: #eef1ef;
}

.opportunity-metadata,
.opportunity-problem {
  overflow-wrap: anywhere;
}

.opportunity-metadata {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.opportunity-problem {
  max-width: 720px;
  margin: 12px 0 0;
  color: #46514c;
  font-size: 13px;
  line-height: 1.55;
}

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

.opportunity-actions a,
.opportunity-actions button {
  border: 0;
  color: var(--green);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.opportunity-actions a:hover,
.opportunity-actions button:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.opportunities-empty {
  padding: 38px 0;
  color: #39433f;
}

.opportunities-empty p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.knowledge-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.knowledge-header h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.upload-command,
.secondary-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid #bfc9c4;
  border-radius: 5px;
  color: #35413c;
  background: #ffffff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.upload-command:hover,
.secondary-button:hover {
  border-color: #7f938a;
  background: var(--soft);
}

.knowledge-body {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 28px 34px 70px;
}

.knowledge-band {
  padding: 8px 0 32px;
  border-bottom: 1px solid var(--line);
}

.knowledge-band + .knowledge-band {
  padding-top: 32px;
}

.knowledge-band:last-child {
  border-bottom: 0;
}

.knowledge-band-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.knowledge-band-heading h2 {
  margin: 5px 0 0;
  font-size: 18px;
  letter-spacing: 0;
}

.company-memory-content {
  margin-top: 22px;
  color: #35403b;
  font-size: 14px;
  line-height: 1.6;
}

.company-memory-content .memory-summary {
  max-width: 740px;
  margin: 0 0 24px;
  font-size: 15px;
}

.company-memory-content section {
  margin-top: 20px;
}

.company-memory-content h3,
.setup-memory h3 {
  margin: 0 0 7px;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.company-memory-content p,
.company-memory-content ul,
.setup-memory p,
.setup-memory ul {
  margin: 0;
}

.company-memory-content ul,
.setup-memory ul {
  padding-left: 20px;
}

.document-list {
  margin-top: 18px;
}

.document-row {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #e8ecea;
}

.document-row:last-child {
  border-bottom: 0;
}

.document-details {
  min-width: 0;
}

.document-details strong,
.document-details span {
  display: block;
}

.document-details strong {
  overflow-wrap: anywhere;
  color: #303a36;
  font-size: 13px;
}

.document-details span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.remove-document-button {
  flex: 0 0 auto;
  padding: 5px 7px;
  border: 0;
  color: var(--red);
  background: transparent;
  font-size: 12px;
}

.remove-document-button:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.context-header {
  display: flex;
  height: 74px;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
}

.context-header h2 {
  font-size: 15px;
}

.context-section {
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.package-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.package-row strong {
  font-size: 14px;
}

.tier-label,
.count {
  color: #5a6661;
  font-size: 11px;
}

.tier-label {
  padding: 4px 7px;
  border: 1px solid #d5ddd9;
  border-radius: 4px;
  background: #ffffff;
  text-transform: capitalize;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.capability-list {
  display: grid;
  gap: 2px;
  margin-top: 12px;
}

.capability-item {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 9px;
  color: #3d4843;
  font-size: 13px;
}

.capability-item::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #66a884;
  content: "";
}

.activity-section {
  border-bottom: 0;
}

.activity-list {
  margin-top: 12px;
}

.activity-item {
  position: relative;
  padding: 0 0 18px 18px;
  border-left: 1px solid #d5dcd8;
}

.activity-item:last-child {
  padding-bottom: 0;
  border-left-color: transparent;
}

.activity-dot {
  position: absolute;
  top: 3px;
  left: -4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #72a78d;
}

.activity-item.denied .activity-dot,
.activity-item.failed .activity-dot {
  background: #c7675e;
}

.activity-item.started .activity-dot {
  background: #d0964c;
}

.activity-title {
  display: block;
  color: #35403b;
  font-size: 12px;
  font-weight: 700;
}

.activity-detail,
.activity-time,
.empty-state {
  color: var(--muted);
  font-size: 11px;
}

.activity-detail {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.activity-time {
  display: block;
  margin-top: 4px;
}

.empty-state {
  margin: 12px 0 0;
}

.sign-in-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: #eef1ef;
}

.onboarding-view {
  min-height: 100vh;
  overflow-y: auto;
  background: #f4f6f5;
}

.onboarding-topbar {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(22px, 5vw, 64px);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.onboarding-content {
  width: min(680px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(56px, 9vh, 96px) 0;
}

.onboarding-content > h1 {
  max-width: 600px;
  margin: 0;
  font-size: clamp(30px, 5vw, 44px);
  letter-spacing: 0;
}

.onboarding-description {
  max-width: 580px;
  margin: 14px 0 32px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.setup-form {
  display: grid;
  max-width: 460px;
  gap: 10px;
}

.setup-form label {
  color: #3f4945;
  font-size: 12px;
  font-weight: 700;
}

.setup-form input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid #c8d0cc;
  border-radius: 6px;
  outline: 0;
  background: #ffffff;
}

.setup-form input:focus {
  border-color: #5b9679;
  box-shadow: 0 0 0 3px #e4efe9;
}

.setup-form .primary-button {
  width: 150px;
  margin-top: 6px;
}

.setup-upload {
  max-width: 620px;
}

.document-dropzone {
  display: grid;
  min-height: 180px;
  place-content: center;
  gap: 8px;
  padding: 30px;
  border: 1px dashed #9aacb2;
  border-radius: 7px;
  color: #2f3b36;
  background: #ffffff;
  text-align: center;
  cursor: pointer;
}

.document-dropzone:hover {
  border-color: var(--green);
  background: #f9fbfa;
}

.document-dropzone span {
  color: var(--muted);
  font-size: 12px;
}

.setup-memory {
  max-width: 650px;
  color: #35403b;
  font-size: 14px;
  line-height: 1.6;
}

.setup-memory section {
  margin-top: 20px;
}

.setup-memory .primary-button {
  width: 160px;
  margin-top: 30px;
}

.setup-status {
  min-height: 18px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.sign-in-panel {
  display: grid;
  width: min(420px, 100%);
  gap: 34px;
  padding: 34px;
  border: 1px solid #d6deda;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(24, 33, 30, 0.08);
}

.sign-in-panel h1 {
  font-size: 28px;
}

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

.sign-in-form {
  display: grid;
  gap: 9px;
}

.sign-in-form label {
  color: #3f4945;
  font-size: 12px;
  font-weight: 700;
}

.sign-in-form input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #c8d0cc;
  border-radius: 6px;
  outline: 0;
}

.sign-in-form input:focus {
  border-color: #5b9679;
  box-shadow: 0 0 0 3px #e4efe9;
}

.primary-button {
  height: 44px;
  margin-top: 4px;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  background: var(--green);
  font-weight: 700;
}

.primary-button:hover {
  background: #1d6546;
}

.primary-button:disabled {
  opacity: 0.55;
}

.form-error {
  min-height: 16px;
  margin: 0;
  color: var(--red);
  font-size: 12px;
}

.mobile-only {
  display: none;
}

.mobile-sign-out {
  width: 100%;
  height: 38px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #4d5854;
  background: #ffffff;
  text-align: center;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .context-panel {
    position: fixed;
    z-index: 10;
    top: 0;
    right: 0;
    width: min(340px, 90vw);
    height: 100vh;
    transform: translateX(100%);
    border-left: 1px solid var(--line);
    box-shadow: -16px 0 40px rgba(22, 31, 27, 0.12);
    transition: transform 160ms ease;
  }

  .context-panel.open {
    transform: translateX(0);
  }

  #contextButton,
  .mobile-only {
    display: inline-grid;
  }

  .mobile-sign-out {
    display: none;
  }
}

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

  .navigation {
    display: none;
  }

  .conversation {
    height: 100dvh;
    border-right: 0;
  }

  .knowledge-view {
    height: 100dvh;
    border-right: 0;
  }

  .opportunities-view {
    height: 100dvh;
    border-right: 0;
  }

  .opportunities-header {
    min-height: 74px;
    padding: 0 18px;
  }

  .opportunities-body {
    padding: 26px 18px 50px;
  }

  .opportunity-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .opportunity-actions {
    justify-content: flex-start;
  }

  .knowledge-header {
    min-height: 74px;
    padding: 0 18px;
  }

  .knowledge-body {
    padding: 24px 18px 50px;
  }

  .upload-command {
    padding: 0 10px;
  }

  .onboarding-content {
    width: min(100% - 32px, 680px);
    padding: 48px 0;
  }

  .conversation-header {
    padding: 0 18px;
  }

  .connection-status {
    display: none;
  }

  .mobile-sign-out {
    display: block;
  }

  .chat-log {
    padding: 24px 18px 130px;
  }

  .composer {
    bottom: 14px;
    width: calc(100% - 28px);
  }

  .suggestion-list {
    grid-template-columns: 1fr;
  }

  .empty-conversation {
    top: 42%;
  }

  .sign-in-panel {
    padding: 26px 22px;
  }
}
