:root {
  color-scheme: light;
  --ink: #17211b;
  --muted: #65726b;
  --line: #dbe2dd;
  --paper: #fbfcfa;
  --panel: #ffffff;
  --mist: #eef4f0;
  --blue: #2864b8;
  --green: #26745d;
  --rose: #a5475f;
  --amber: #a86d1d;
  --shadow: 0 14px 40px rgb(29 43 35 / 12%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgb(242 247 244 / 92%), rgb(250 250 246 / 96%)),
    radial-gradient(circle at 20% 10%, rgb(40 100 184 / 16%), transparent 28%),
    radial-gradient(circle at 85% 12%, rgb(165 71 95 / 13%), transparent 26%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 22px;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.25;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 72px;
  padding: 12px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(40 100 184 / 14%);
}

.primary-button,
.secondary-button,
.icon-button,
.login-panel button,
.composer button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button,
.login-panel button,
.composer button {
  background: var(--blue);
  color: #fff;
}

.secondary-button {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.icon-button {
  width: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.error {
  min-height: 20px;
  margin: 0;
  color: var(--rose);
  font-weight: 700;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 320px;
}

.sidebar,
.decision-pane {
  min-height: 0;
  padding: 20px;
  background: rgb(255 255 255 / 82%);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.decision-pane {
  border-right: 0;
  border-left: 1px solid var(--line);
  overflow-y: auto;
}

.brand-row,
.chat-header,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.conversation-list,
.decision-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.conversation-item,
.decision-item {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.conversation-item.active {
  border-color: var(--green);
  background: var(--mist);
}

.conversation-item strong,
.decision-item strong {
  display: block;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.conversation-item span,
.decision-item span,
.decision-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.chat-pane {
  min-width: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.chat-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: rgb(251 252 250 / 88%);
}

.messages {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
}

.empty-state {
  max-width: 760px;
  margin: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(255 255 255 / 78%);
  color: var(--muted);
  line-height: 1.7;
}

.message {
  width: min(760px, 100%);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.user {
  align-self: flex-end;
  border-color: rgb(40 100 184 / 34%);
  background: rgb(239 245 255 / 92%);
}

.message.assistant {
  align-self: flex-start;
  border-color: rgb(38 116 93 / 30%);
  background: rgb(248 252 249 / 95%);
}

.message.loading {
  color: var(--amber);
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 12px;
  padding: 18px 24px 24px;
  border-top: 1px solid var(--line);
  background: rgb(251 252 250 / 9);
}

.composer button {
  align-self: end;
}

dialog {
  width: min(520px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgb(23 33 27 / 38%);
}

.decision-form {
  display: grid;
  gap: 16px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .decision-pane {
    display: none;
  }
}

@media (max-width: 760px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .conversation-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(210px, 72%);
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .chat-pane {
    height: calc(100vh - 190px);
    min-height: 560px;
  }

  .chat-header {
    align-items: flex-start;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer button {
    width: 100%;
  }
}
