:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #272524;
  background: #fcfcfc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: #fcfcfc;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  transition: transform 120ms ease, background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, opacity 140ms ease;
}

input,
select,
textarea {
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

button:active {
  transform: translateY(1px);
  box-shadow: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgb(89 119 155 / 24%);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px 1fr;
  min-height: 100vh;
  background: #fcfcfc;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid #e5e2df;
  background: #f4f4f3;
}

.brand-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 44px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #1f1d1b;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
}

.brand-row h1,
.brand-row p {
  margin: 0;
}

.brand-row h1 {
  font-size: 18px;
  line-height: 1.2;
}

.brand-row p,
.sidebar-footer p,
.muted {
  color: #97918c;
}

.brand-row p {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 700;
}

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #7b7570;
  padding: 0 14px;
  text-align: left;
  font-weight: 760;
  transition: transform 120ms ease, background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.nav-item span {
  width: 20px;
  color: #57524d;
  text-align: center;
}

.nav-item.active {
  background: #fff;
  color: #24211f;
}

.nav-item:hover {
  background: #fff;
  color: #24211f;
  box-shadow: 0 3px 12px rgb(39 37 36 / 7%);
}

.nav-item:active {
  transform: translateY(1px);
  box-shadow: none;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 12px 8px;
}

.sidebar-footer p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer strong {
  font-size: 12px;
}

.workspace {
  min-width: 0;
  min-height: 100vh;
  padding: 32px 0 48px;
  background: #fcfcfc;
}

.view {
  display: none;
  width: min(980px, calc(100vw - 360px));
  margin: 0 auto;
}

.view[hidden] {
  display: none !important;
}

.active-view {
  display: block;
}

.page-header,
.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-header {
  margin-bottom: 26px;
}

.page-header h2,
.page-title h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.page-header p,
.page-title p {
  margin: 4px 0 0;
  color: #928c86;
  font-weight: 700;
}

.page-title {
  margin-bottom: 28px;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: calc(100vh - 178px);
  padding-bottom: 170px;
}

.message {
  max-width: 78%;
  border-radius: 8px;
  padding: 18px 20px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.user {
  align-self: flex-end;
  background: #24211f;
  color: #fff;
}

.message.assistant {
  align-self: flex-start;
  max-width: min(760px, 100%);
  border: 0;
  background: transparent;
  padding: 0;
  border-radius: 0;
  white-space: normal;
}

.stream-status,
.stream-preliminary,
.stream-evidence {
  margin-bottom: 8px;
  color: #7b7570;
  font-size: 12px;
  font-weight: 700;
}

.stream-status {
  border-left: 3px solid #d8d4cf;
  padding-left: 10px;
}

.stream-preliminary,
.stream-evidence {
  color: #24211f;
  white-space: normal;
}

.stream-final {
  margin-top: 12px;
  white-space: normal;
}

.eo-answer-body {
  color: #292623;
  font-size: 15px;
  line-height: 1.9;
  white-space: normal;
}

.eo-answer-body p {
  margin: 0 0 16px;
}

.eo-answer-body h3 {
  margin: 30px 0 12px;
  font-size: 18px;
}

.eo-answer-body ul {
  margin: 0 0 18px;
  padding-left: 20px;
}

.eo-answer-body li {
  margin: 6px 0;
}

.eo-markdown-table-wrap {
  margin: 14px 0 22px;
  overflow-x: auto;
}

.eo-markdown-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #e5e2df;
  background: #fff;
  font-size: 12px;
  line-height: 1.55;
}

.eo-markdown-table th,
.eo-markdown-table td {
  border: 1px solid #e5e2df;
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

.eo-markdown-table th {
  background: #f7f5f2;
  color: #3b3632;
  font-weight: 800;
}

.eo-support-stack {
  display: grid;
  gap: 14px;
  margin-top: 26px;
  white-space: normal;
}

.eo-callout,
.eo-card-panel,
.eo-info-card {
  border: 1px solid #e5e2df;
  border-radius: 8px;
  background: #fff;
}

.eo-callout {
  padding: 16px 18px;
}

.eo-callout.warning {
  border-color: #f3d070;
  background: #fff9df;
}

.eo-callout h3,
.eo-card-panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.eo-callout ul,
.eo-card-panel ul,
.eo-card-panel ol {
  margin: 0;
  padding-left: 20px;
}

.eo-card-panel {
  padding: 18px;
}

.eo-card-panel.muted {
  background: #faf9f7;
}

.eo-card-grid {
  display: grid;
  gap: 12px;
}

.eo-card-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.eo-info-card {
  padding: 14px 16px;
}

.eo-info-card h4 {
  margin: 0;
  font-size: 15px;
}

.eo-info-card p {
  margin: 8px 0;
  color: #5f5852;
}

.eo-info-card small {
  display: block;
  color: #8b8178;
}

.eo-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eo-card-heading span,
.severity {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 8px;
  background: #f1efec;
  color: #6d655e;
  font-size: 11px;
  font-weight: 800;
}

.severity.high,
.severity.critical {
  background: #fff0d9;
  color: #9a5a00;
}

.severity.medium {
  background: #fff6cc;
  color: #776000;
}

.eo-table-wrap {
  overflow-x: auto;
}

.eo-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.eo-table-wrap th,
.eo-table-wrap td {
  border-bottom: 1px solid #ece8e3;
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
}

.eo-table-wrap th {
  color: #7b7570;
  font-size: 12px;
}

.stream-panel {
  border: 1px solid #e2ded8;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  white-space: normal;
}

.stream-panel-risk {
  border-color: #f0d59a;
  background: #fffaf0;
}

.stream-panel-label {
  margin: 0 0 5px;
  color: #8b8178;
  font-size: 12px;
  font-weight: 800;
}

.stream-panel h4 {
  margin: 0 0 7px;
  font-size: 14px;
}

.stream-panel p,
.stream-panel ul {
  margin: 5px 0;
}

.stream-panel ul {
  padding-left: 18px;
}

.stream-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.stream-chip-row span {
  border-radius: 999px;
  padding: 3px 8px;
  background: #f1efec;
  color: #5f5852;
  font-size: 12px;
}

.message.error {
  align-self: flex-start;
  border: 1px solid #f3c7bc;
  background: #fff5f2;
  color: #8b2b1b;
}

.assistant-section {
  margin-top: 20px;
}

.assistant-section h3 {
  margin: 0 0 10px;
  font-size: 20px;
}

.warning-box {
  border: 1px solid #eadf80;
  border-radius: 6px;
  background: #fffbea;
  color: #8b5d12;
  padding: 16px;
  font-weight: 760;
}

.citation-box {
  border: 1px solid #e5e2df;
  border-radius: 6px;
  background: #fff;
  color: #6f6964;
  padding: 16px;
}

.composer {
  position: fixed;
  right: max(48px, calc((100vw - 292px - min(980px, calc(100vw - 360px))) / 2));
  bottom: 28px;
  left: max(340px, calc(292px + (100vw - 292px - min(980px, calc(100vw - 360px))) / 2));
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 10px 14px;
  border: 1px solid #e0ddd9;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 36px rgb(48 45 42 / 12%);
  padding: 14px;
}

.composer textarea {
  grid-column: 1 / 2;
  min-height: 48px;
  border: 0;
  resize: none;
  font-size: 16px;
  outline: none;
}

.composer-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-toggle {
  display: inline-flex;
  overflow: hidden;
  border-radius: 6px;
  background: #f2f1f0;
  padding: 3px;
}

.mode-toggle button {
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #7b7570;
  padding: 0 14px;
  font-weight: 760;
}

.mode-toggle button.active {
  background: #fff;
  color: #24211f;
}

.mode-toggle button:hover {
  background: #fff;
  color: #24211f;
}

.send-button {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  align-self: end;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: #898682;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

.send-button:hover {
  background: #6f6b67;
  box-shadow: 0 4px 14px rgb(48 45 42 / 18%);
}

.search-bar,
.notes-toolbar {
  margin-bottom: 18px;
}

.search-bar input,
.notes-toolbar input,
.account-card input,
.account-card textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #e0ddd9;
  border-radius: 4px;
  background: #fff;
  color: #24211f;
  padding: 10px 12px;
}

.search-bar input {
  min-height: 52px;
  font-size: 18px;
}

.dictionary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dictionary-card,
.note-card,
.account-card,
.empty-state {
  border: 1px solid #e5e2df;
  border-radius: 6px;
  background: #fff;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.dictionary-card:hover,
.note-card:hover,
.account-card:hover {
  border-color: #d6d1cc;
  box-shadow: 0 6px 18px rgb(48 45 42 / 8%);
}

.dictionary-card {
  min-height: 112px;
  padding: 22px 24px;
}

.dictionary-card h3,
.dictionary-card p,
.dictionary-card small {
  margin: 0;
}

.dictionary-card h3 {
  font-size: 20px;
}

.dictionary-card p {
  margin-top: 8px;
  color: #716b65;
  font-size: 16px;
  font-weight: 730;
}

.dictionary-card small {
  display: block;
  margin-top: 8px;
  color: #9b9691;
  font-style: italic;
}

.notes-toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: center;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #6f6964;
  white-space: nowrap;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
}

.note-list {
  display: grid;
  gap: 14px;
}

.note-card {
  padding: 18px 20px;
}

.note-summary {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: start;
  cursor: pointer;
  list-style: none;
}

.note-summary::-webkit-details-marker {
  display: none;
}

.note-card input {
  width: 18px;
  height: 18px;
  margin-top: 4px;
}

.note-card h3,
.note-card p {
  margin: 0;
}

.note-card h3 {
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.5;
}

.note-card p {
  color: #928c86;
  font-size: 13px;
}

.note-preview {
  margin-top: 8px;
  line-height: 1.5;
}

.note-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #aaa49f;
}

.danger-button {
  min-height: 42px;
  border: 1px solid #d8c7c0;
  border-radius: 4px;
  background: #fff5f2;
  color: #8b2b1b;
  padding: 9px 14px;
  font-weight: 800;
}

.danger-button:hover {
  border-color: #c9998b;
  background: #ffe9e2;
}

.icon-button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid #ded9d4;
  border-radius: 6px;
  background: #fff;
  color: #8f8983;
  font-weight: 700;
  line-height: 1;
}

.danger-icon {
  width: auto;
  min-width: 44px;
  padding: 0 8px;
  border-color: #ead3ca;
  color: #9a3a27;
  font-size: 12px;
}

.danger-icon:hover {
  border-color: #d5aa9c;
  background: #fff5f2;
}

.note-toggle {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  font-size: 18px;
  transition: transform 160ms ease;
}

.note-card[open] .note-toggle {
  transform: rotate(180deg);
}

.note-content {
  margin: 16px 0 0 40px;
  padding: 16px 18px;
  border-top: 1px solid #ebe6e1;
  background: #fbfaf8;
  white-space: normal;
}

.note-content p {
  margin: 0;
  color: #2d2a27;
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note-content .eo-answer-body {
  font-size: 14px;
  line-height: 1.8;
}

.note-content .eo-support-stack {
  margin-top: 20px;
}

.confirm-dialog {
  width: min(420px, calc(100vw - 40px));
  border: 1px solid #e2dcd6;
  border-radius: 8px;
  padding: 0;
  background: #fff;
  box-shadow: 0 20px 60px rgb(40 36 32 / 22%);
}

.confirm-dialog::backdrop {
  background: rgb(30 28 26 / 36%);
}

.confirm-dialog form {
  padding: 24px;
}

.confirm-dialog h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.confirm-dialog p {
  margin: 0 0 22px;
  color: #5f5852;
  line-height: 1.7;
}

.account-card {
  margin-bottom: 16px;
  padding: 20px;
}

.account-card h3 {
  margin: 0 0 16px;
  font-size: 18px;
}

.account-card label {
  display: grid;
  gap: 8px;
  color: #817b75;
  font-size: 12px;
  font-weight: 760;
}

.info-grid,
.api-key-grid,
.point-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.button-row button,
.secondary {
  min-height: 38px;
  border: 1px solid #d8d4cf;
  border-radius: 4px;
  background: #fff;
  color: #24211f;
  padding: 8px 14px;
  font-weight: 760;
}

.button-row button:hover,
.secondary:hover,
.plan-card button:hover,
.purchase-row button:hover {
  border-color: #8f8983;
  background: #f6f4f2;
  color: #24211f;
  box-shadow: 0 3px 12px rgb(48 45 42 / 10%);
}

.button-row button:first-child,
.purchase-row button.primary {
  border-color: #24211f;
  background: #24211f;
  color: #fff;
}

.button-row button:first-child:hover,
.purchase-row button.primary:hover,
.plan-card button:hover {
  border-color: #3a3632;
  background: #3a3632;
  color: #fff;
}

.accent {
  border-color: #f2b16d;
  color: #d06b10;
}

.text-button {
  border: 0;
  background: transparent;
  color: #817b75;
  padding: 0;
  text-align: left;
  font-weight: 760;
  transition: color 140ms ease, transform 120ms ease;
}

.text-button:hover {
  color: #24211f;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 4px;
  background: #f2f1f0;
  color: #5e5853;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.plan-card {
  position: relative;
  border: 1px solid #e5e2df;
  border-radius: 4px;
  padding: 18px;
}

.plan-card.current {
  border-color: #8c8782;
  box-shadow: inset 0 0 0 1px #8c8782;
}

.plan-card h4 {
  margin: 0 0 8px;
  font-size: 18px;
}

.plan-price {
  position: absolute;
  top: 20px;
  right: 18px;
  color: #5e5853;
  font-weight: 800;
}

.plan-card ul {
  margin: 14px 0;
  padding-left: 18px;
  color: #6f6964;
  line-height: 1.9;
}

.plan-card button {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 3px;
  background: #24211f;
  color: #fff;
  font-weight: 800;
}

.plan-card.current button {
  background: #e9e7e5;
  color: #aaa49f;
}

.point-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  align-items: center;
  margin-bottom: 16px;
}

.point-summary strong {
  grid-row: span 2;
  font-size: 26px;
}

.point-summary > span {
  grid-column: 2;
  color: #817b75;
  font-size: 12px;
}

.usage-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eceae8;
}

.usage-bar div {
  width: 58%;
  height: 100%;
  background: #85807a;
}

.point-breakdown {
  margin-top: 16px;
}

.point-breakdown div {
  border-radius: 4px;
  background: #fafafa;
  padding: 14px;
}

.point-breakdown .wide {
  grid-column: 1 / -1;
  border: 1px solid #d5e5ff;
  background: #eef5ff;
  color: #2764d8;
}

.point-breakdown span,
.point-breakdown small {
  display: block;
  color: #817b75;
  font-size: 12px;
}

.point-breakdown strong {
  display: block;
  margin: 6px 0 2px;
  font-size: 20px;
}

.point-costs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin-top: 16px;
  border-top: 1px solid #ebe8e5;
  padding-top: 14px;
  color: #6f6964;
  font-size: 13px;
}

.point-costs div {
  display: flex;
  justify-content: space-between;
}

.purchase-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.purchase-row button {
  min-height: 38px;
  border-radius: 4px;
  padding: 8px 14px;
  font-weight: 800;
}

.copy-field {
  display: grid;
  grid-template-columns: 1fr 58px;
  gap: 8px;
}

.notice {
  margin-top: 14px;
  border-radius: 4px;
  background: #fafafa;
  color: #5e5853;
  padding: 14px;
  line-height: 1.65;
}

.developer-card summary {
  cursor: pointer;
  font-weight: 800;
}

.result-box {
  display: none;
}

.empty-state {
  color: #817b75;
  padding: 18px;
}

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

  .sidebar {
    position: static;
    min-height: auto;
  }

  .view {
    width: min(100% - 28px, 980px);
  }

  .composer {
    right: 14px;
    left: 14px;
  }

  .dictionary-grid,
  .plan-grid,
  .info-grid,
  .api-key-grid,
  .point-breakdown {
    grid-template-columns: 1fr;
  }
}

