:root {
  --ink: #171817;
  --muted: #646960;
  --line: #dfe4d8;
  --paper: #f8f5ec;
  --surface: #ffffff;
  --sage: #586b4f;
  --clay: #af654b;
  --blue: #3f7897;
  --gold: #d3a33a;
  --moss: #7f8f67;
  --stone: #d8d3c7;
  --danger: #a33d3d;
  --shadow: 0 22px 64px rgba(30, 34, 27, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(88, 107, 79, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(88, 107, 79, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 12% 14%, rgba(211, 163, 58, 0.18), transparent 24%),
    var(--paper);
  background-size: 42px 42px;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.auth-panel {
  width: min(1180px, calc(100% - 36px));
  min-height: 100svh;
  display: grid;
  align-content: center;
  gap: 18px;
  margin: 0 auto;
  padding: 18px 0;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 850;
  font-size: 1.05rem;
}

.brand-mark {
  position: relative;
  width: 42px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 48% 52% 44% 56%;
  background: linear-gradient(145deg, #2d302b, #171817);
  color: #fff;
  box-shadow:
    inset -4px -5px 0 rgba(255, 255, 255, 0.08),
    0 10px 22px rgba(30, 34, 27, 0.18);
}

.brand-mark::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(211, 163, 58, 0.16);
}

.auth-copy {
  max-width: 870px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--clay);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  font-size: 4.25rem;
  line-height: 0.96;
  letter-spacing: 0;
}

.auth-copy p {
  max-width: 780px;
  color: var(--muted);
  font-size: 1rem;
}

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

.google-button,
.dev-button,
.composer button,
.plan-button,
#logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  border-radius: 8px;
  font-weight: 800;
}

.google-button {
  padding: 0 22px;
  background: var(--ink);
  color: #fff;
}

.dev-button {
  padding: 0 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

#auth-note {
  flex-basis: 100%;
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.launch-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  max-width: 100%;
}

.launch-flow div {
  min-height: 82px;
  display: grid;
  align-content: space-between;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.launch-flow strong {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #edf2e8;
  color: var(--sage);
}

.launch-flow span {
  font-weight: 800;
}

.product-panel {
  min-height: 100vh;
  padding: 22px;
}

.product-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1440px, 100%);
  margin: 0 auto 18px;
}

.account-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.account-strip img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #e6ebdf;
}

.account-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

#logout-button {
  width: 42px;
  min-height: 42px;
  border: 0;
  background: #eef2e8;
  color: var(--sage);
}

.workspace-status,
.workspace {
  width: min(1440px, 100%);
  margin: 0 auto;
}

.workspace-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.status-chip {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  font-weight: 850;
  box-shadow: 0 10px 28px rgba(30, 34, 27, 0.08);
}

.status-chip.muted {
  color: var(--muted);
  font-weight: 750;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 18px;
}

.chat-card,
.context-card,
.landing-capabilities {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.context-card {
  min-width: 0;
  padding: 22px;
}

.context-card h2,
.chat-header h2 {
  margin-bottom: 8px;
  font-size: 1.55rem;
  line-height: 1.1;
}

.context-card h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
  line-height: 1.15;
}

.context-intro {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.94rem;
}

.small-copy,
.chat-header p,
.status-line {
  color: var(--muted);
}

.context-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  min-width: 0;
}

.context-form label {
  display: grid;
  gap: 7px;
  color: #30342d;
  font-weight: 800;
}

.context-form input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fbfcf8;
  font-size: 0.92rem;
}

.file-picker {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #fbfcf8;
}

.file-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.file-button {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 850;
  box-shadow: inset 0 0 0 1px var(--line);
}

.file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.context-form button {
  min-height: 42px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: var(--sage);
  color: #fff;
  font-weight: 850;
}

.context-list {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  min-width: 0;
}

.context-item {
  display: grid;
  grid-template-columns: 1fr 34px;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.context-item strong,
.context-item span {
  display: block;
}

.context-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  font-size: 0.9rem;
}

.context-item span {
  color: var(--muted);
  font-size: 0.78rem;
}

.context-item button {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: 0;
  border-radius: 8px;
  background: #f2e5dd;
  color: var(--clay);
}

.engine-status {
  margin: 0 0 10px;
  font-size: 0.92rem;
  font-weight: 800;
}

.engine-status.warning {
  color: var(--danger);
}

.main-column {
  display: grid;
  gap: 18px;
}

.chat-card {
  height: calc(100vh - 154px);
  min-height: 620px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header,
.capability-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.channel-pill {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: #edf2e8;
  color: var(--sage);
  font-size: 0.8rem;
  font-weight: 850;
}

.landing-capabilities {
  display: grid;
  gap: 12px;
  max-width: 1180px;
  padding: 14px;
}

.landing-capabilities h2 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.1;
}

.capability-subcopy {
  max-width: 720px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.landing-disclaimer {
  max-width: 980px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.capability-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.capability-grid article {
  min-height: 128px;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.capability-grid article:nth-child(4n) {
  border-right: 0;
}

.capability-grid article:nth-last-child(-n + 4) {
  border-bottom: 0;
}

.capability-grid h3 {
  margin: 0;
}

.capability-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.status {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 850;
}

.status.ready {
  background: #e5f1df;
  color: var(--sage);
}

.status.partial {
  background: #fff1d4;
  color: #83621c;
}

.status.planned {
  background: #e5eef4;
  color: var(--blue);
}

.thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 22px;
  overflow-y: auto;
}

.show-older {
  width: calc(100% - 32px);
  min-height: 38px;
  margin: 0 16px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--sage);
  font-weight: 850;
}

.message {
  max-width: min(78%, 720px);
  padding: 13px 15px;
  border-radius: 16px;
}

.message.assistant {
  align-self: flex-start;
  background: linear-gradient(145deg, #eef2e7, #f7f3e6);
  border-bottom-left-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(88, 107, 79, 0.08);
}

.message.user {
  align-self: flex-end;
  background: var(--ink);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.message-content > :first-child {
  margin-top: 0;
}

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

.message-content p,
.message-content ul,
.message-content ol {
  margin: 0 0 10px;
}

.message-content ul,
.message-content ol {
  padding-left: 22px;
}

.message-content li {
  margin: 4px 0;
}

.message-content strong {
  font-weight: 850;
}

.message-content code {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(21, 22, 21, 0.08);
  font-size: 0.92em;
}

.message-content pre {
  overflow-x: auto;
  padding: 12px;
  border-radius: 8px;
  background: #171817;
  color: #fff;
}

.message-content pre code {
  padding: 0;
  background: transparent;
}

.message-content a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.artifact-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.artifact-link {
  display: inline-flex;
  width: fit-content;
  min-height: 34px;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  background: #fff;
  color: var(--sage);
  font-size: 0.86rem;
  font-weight: 850;
}

.composer {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 52px;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.composer input {
  min-width: 0;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 15px;
}

.composer button,
.plan-button {
  border: 0;
  background: var(--clay);
  color: #fff;
}

.status-line {
  min-height: 22px;
  margin: 0;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  font-size: 0.9rem;
}

.plan-list {
  display: grid;
  gap: 12px;
  margin: 0 0 12px;
}

.billing-details {
  position: relative;
}

.billing-details summary {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sage);
  color: #fff;
  cursor: pointer;
  font-weight: 850;
  list-style: none;
}

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

.billing-popover {
  position: absolute;
  top: 46px;
  left: 0;
  z-index: 30;
  width: 300px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.plan-option {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.plan-option h3 {
  margin: 0;
}

.plan-option p {
  margin: 0;
  color: var(--muted);
}

.plan-button {
  min-height: 40px;
}

svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

@media (max-width: 1080px) {
  h1 {
    font-size: 3.2rem;
  }

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

  .workspace-status {
    flex-wrap: wrap;
  }

  .capability-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .capability-grid article:nth-child(4n) {
    border-right: 1px solid var(--line);
  }

  .capability-grid article:nth-child(2n) {
    border-right: 0;
  }

  .capability-grid article:nth-last-child(-n + 4) {
    border-bottom: 1px solid var(--line);
  }

  .capability-grid article:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .chat-card {
    height: auto;
    min-height: 620px;
  }
}

@media (max-width: 680px) {
  .auth-panel,
  .product-panel {
    width: 100%;
    padding: 18px;
  }

  h1 {
    font-size: 2.45rem;
  }

  .launch-flow {
    grid-template-columns: 1fr;
  }

  .product-header,
  .chat-header,
  .capability-header {
    align-items: stretch;
    flex-direction: column;
  }

  .account-strip {
    width: 100%;
  }

  .message {
    max-width: 92%;
  }

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

  .capability-grid article,
  .capability-grid article:nth-child(2n) {
    border-right: 0;
  }

  .capability-grid article:nth-last-child(2) {
    border-bottom: 1px solid var(--line);
  }
}
