:root {
  color-scheme: light;
  --ink: #152033;
  --muted: #657084;
  --line: #d8dee8;
  --soft: #f6f7f9;
  --panel: #ffffff;
  --brand: #e8913a;
  --brand-dark: #bf6118;
  --focus: #1f6feb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 0 14px;
  color: #ffffff;
  background: var(--ink);
  cursor: pointer;
}

button:hover {
  background: #24324a;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 25%, transparent);
  outline-offset: 2px;
}

input {
  min-width: 0;
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid var(--line);
  padding: 28px;
  background: #ffffff;
}

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

h1,
h2 {
  margin: 0;
  line-height: 1.1;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
}

h2 {
  font-size: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.connect-form {
  display: grid;
  gap: 8px;
}

.connect-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ghost-button {
  min-height: 34px;
  border-color: var(--line);
  color: var(--ink);
  background: #ffffff;
}

.ghost-button:hover {
  background: var(--soft);
}

.accounts-list {
  display: grid;
  gap: 8px;
}

.account-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

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

.account-email {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
}

.account-item button {
  justify-self: start;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background: #ffffff;
}

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

.chat-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
}

.quick-actions button {
  border-color: var(--line);
  color: var(--ink);
  background: #ffffff;
}

.quick-actions button:hover {
  background: #fff3e8;
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
}

.messages {
  display: flex;
  min-height: 320px;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
}

.message {
  max-width: min(820px, 100%);
  border-radius: 8px;
  padding: 12px 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.message.user {
  align-self: end;
  color: #ffffff;
  background: var(--ink);
}

.message.assistant {
  align-self: start;
  border: 1px solid var(--line);
  background: #fbfcfe;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
}

.is-loading {
  opacity: 0.65;
  pointer-events: none;
}

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

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

  .chat-header {
    display: grid;
  }

  .quick-actions {
    justify-content: start;
  }
}

@media (max-width: 520px) {
  .sidebar,
  .chat-panel {
    padding: 18px;
  }

  .connect-row,
  .chat-form {
    grid-template-columns: 1fr;
  }
}
