:root {
  color-scheme: light;
  --page: #eef2ef;
  --ink: #17211d;
  --muted: #64716b;
  --line: #cfd8d2;
  --panel: #ffffff;
  --soft: #f6f8f5;
  --accent: #256f5a;
  --accent-strong: #164f3d;
  --teal: #d8eee5;
  --blue: #dfeaf7;
  --plum: #eee4f2;
  --warn: #9b5b18;
  --bad: #9a3328;
  --good: #287553;
  --shadow: 0 24px 70px rgba(37, 57, 48, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(115deg, rgba(216, 238, 229, 0.9), rgba(223, 234, 247, 0.68) 50%, rgba(238, 228, 242, 0.7)),
    var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  min-height: 44px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

button.ghost {
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent-strong);
  border-color: rgba(37, 111, 90, 0.24);
}

button.ghost:hover {
  background: #fff;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 111, 90, 0.32);
  outline-offset: 2px;
}

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

.app-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0;
}

.brand p,
.eyebrow,
.strategy-meta,
.count {
  color: var(--muted);
}

.top-actions,
.status-grid,
.panel-head,
.chat-head,
.composer-tools,
.input-row,
.switch,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-grid {
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid rgba(23, 33, 29, 0.12);
  border-radius: 999px;
  padding: 5px 11px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  white-space: nowrap;
  backdrop-filter: blur(10px);
}

.pill.good {
  border-color: rgba(40, 117, 83, 0.28);
  color: var(--good);
}

.pill.bad {
  border-color: rgba(154, 51, 40, 0.32);
  color: var(--bad);
}

.pill.warn {
  border-color: rgba(155, 91, 24, 0.34);
  color: var(--warn);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 134px);
}

.strategy-panel,
.chat-panel {
  border: 1px solid rgba(23, 33, 29, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.strategy-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.panel-head {
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
}

#filterInput {
  margin: 14px;
  width: calc(100% - 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.strategy-list {
  overflow: auto;
  padding: 0 10px 14px;
}

.strategy-item {
  width: 100%;
  display: grid;
  gap: 5px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 12px;
}

.strategy-item:hover,
.strategy-item.active {
  border-color: rgba(37, 111, 90, 0.22);
  background: var(--soft);
}

.strategy-name {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.strategy-meta {
  font-size: 13px;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  overflow: hidden;
}

.chat-head {
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h2 {
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1.1;
  letter-spacing: 0;
}

.switch {
  white-space: nowrap;
  color: var(--muted);
}

.chat-stream {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
  padding: 20px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 880px;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.user .avatar {
  background: var(--accent);
}

.message.user .bubble {
  background: var(--accent);
  color: #fff;
}

.bubble {
  border: 1px solid rgba(23, 33, 29, 0.1);
  border-radius: 8px;
  padding: 14px 16px;
  background: #fff;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.assistant .bubble {
  background: var(--soft);
}

.composer {
  border-top: 1px solid var(--line);
  padding: 14px;
  background: rgba(255, 255, 255, 0.9);
}

.suggestion-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: thin;
}

.suggestion {
  flex: 0 0 auto;
  max-width: min(360px, 78vw);
  min-height: 44px;
  border-color: rgba(37, 111, 90, 0.2);
  background: #fff;
  color: var(--accent-strong);
  text-align: left;
  white-space: normal;
}

.suggestion:hover {
  background: var(--teal);
}

.composer-tools {
  justify-content: space-between;
  margin-bottom: 10px;
}

.composer-label {
  color: var(--muted);
  font-size: 13px;
}

select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

select {
  min-height: 44px;
  padding: 8px 10px;
}

.input-row {
  align-items: end;
}

textarea {
  width: 100%;
  min-height: 58px;
  max-height: 180px;
  resize: vertical;
  padding: 14px;
  line-height: 1.45;
}

#askBtn {
  min-width: 92px;
}

dialog {
  width: min(420px, calc(100vw - 28px));
  border: 1px solid rgba(23, 33, 29, 0.14);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(15, 24, 20, 0.42);
}

.access-card {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.access-card input {
  min-height: 44px;
  padding: 10px 12px;
}

.dialog-actions {
  justify-content: flex-end;
}

.empty,
.error {
  padding: 12px;
  color: var(--muted);
}

.error {
  color: var(--bad);
}

@media (max-width: 880px) {
  .app-shell {
    width: min(100vw - 20px, 760px);
    padding: 14px 0;
  }

  .topbar,
  .chat-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .strategy-panel {
    max-height: 330px;
  }

  .input-row {
    align-items: stretch;
    flex-direction: column;
  }

  #askBtn {
    width: 100%;
  }
}
