:root {
  --bg: #f6f2e9;
  --ink: #171512;
  --muted: #706b61;
  --card: #fffaf0;
  --line: #e1d8c8;
  --brand: #0f5132;
  --brand-2: #ffb020;
  --brand-3: #171512;
  --danger: #a7382d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 176, 32, 0.2), transparent 28rem),
    linear-gradient(135deg, #f8f4ec, #efe6d7);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.shell {
  min-height: 100vh;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 6vw;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  overflow: hidden;
  flex: 0 0 auto;
}

.cat-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: translateY(1px);
}

.hero-visual {
  position: relative;
  overflow: hidden;
}

.hero-visual::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 280px;
  height: 280px;
  border-radius: 999px;
  background: rgba(15, 81, 50, 0.08);
}

.cat-orb {
  display: grid;
  width: 124px;
  height: 124px;
  margin-bottom: 18px;
  place-items: center;
  border-radius: 36px;
  background: transparent;
  color: inherit;
  box-shadow: 0 26px 70px rgba(21, 18, 13, 0.18);
  overflow: hidden;
}

.cat-orb .cat-logo {
  width: 100%;
  height: 100%;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary,
button.secondary {
  background: transparent;
  color: var(--ink);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 48px;
  align-items: center;
  padding: 70px 6vw 90px;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 18px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.75);
  color: var(--brand);
  font-weight: 760;
}

h1 {
  margin: 0;
  font-size: clamp(46px, 7vw, 92px);
  line-height: 0.95;
  letter-spacing: -0.08em;
}

.lead {
  max-width: 720px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 32px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 34px;
}

.stat,
.panel,
.card,
.form-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 250, 240, 0.82);
  box-shadow: 0 18px 50px rgba(74, 50, 15, 0.08);
}

.stat {
  padding: 18px;
}

.stat strong {
  display: block;
  font-size: 24px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
}

.panel {
  padding: 26px;
}

.code {
  overflow: auto;
  padding: 18px;
  border-radius: 18px;
  background: #15120d;
  color: #f7f1df;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
}

.doc-list {
  max-width: 900px;
  padding-left: 24px;
  color: var(--muted);
  line-height: 1.8;
}

.doc-list li {
  margin: 8px 0;
}

.section {
  padding: 30px 6vw 80px;
}

.section h2 {
  margin: 0 0 24px;
  font-size: clamp(30px, 4vw, 54px);
  letter-spacing: -0.05em;
}

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

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

.provider-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fffdf8;
}

.provider-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.provider-head h3 {
  margin: 0 0 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.pill.ok {
  background: rgba(15, 81, 50, 0.12);
  color: var(--brand);
}

.pill.warn {
  background: rgba(255, 176, 32, 0.18);
  color: #835400;
}

.test-result {
  margin: 12px 0;
  padding: 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
}

.test-result.success {
  background: rgba(15, 81, 50, 0.09);
  color: var(--brand);
}

.test-result.failed {
  background: rgba(167, 56, 45, 0.09);
  color: var(--danger);
}

.card {
  padding: 24px;
}

.card h3 {
  margin: 0 0 10px;
}

.card p,
.muted {
  color: var(--muted);
  line-height: 1.6;
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.2fr);
  gap: 24px;
  margin: 10px 6vw 0;
  padding: 28px 0 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.site-footer strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 16px;
}

.site-footer p {
  max-width: 620px;
  margin: 6px 0;
  line-height: 1.7;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 16px;
}

.site-footer a {
  color: var(--ink);
  font-weight: 700;
}

.legal-page h1 {
  max-width: 980px;
}

.legal-stack {
  display: grid;
  gap: 16px;
  max-width: 980px;
  margin-top: 30px;
}

.legal-stack .card h3 {
  margin-top: 0;
}

.legal-stack .card p {
  margin-bottom: 0;
}

.auth-wrap {
  display: grid;
  min-height: calc(100vh - 84px);
  place-items: center;
  padding: 40px 20px;
}

.form-card {
  width: min(460px, 100%);
  padding: 30px;
}

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

input,
select,
textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
}

textarea {
  min-height: 96px;
}

.dash {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.75);
  padding: 24px;
}

.side-nav {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.side-nav a {
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--muted);
  text-decoration: none;
}

.side-nav a.active,
.side-nav a:hover {
  background: var(--ink);
  color: white;
}

.content {
  padding: 34px;
}

.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(255, 250, 240, 0.84);
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
}

.notice {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(15, 81, 50, 0.1);
  color: var(--brand);
}

.error {
  background: rgba(167, 56, 45, 0.1);
  color: var(--danger);
}

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

.chat-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  padding: 28px 6vw 60px;
}

.chat-main {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  min-height: calc(100vh - 150px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 250, 240, 0.82);
  box-shadow: 0 18px 50px rgba(74, 50, 15, 0.08);
  overflow: hidden;
}

.chat-header {
  padding: 26px;
  border-bottom: 1px solid var(--line);
}

.chat-header h1 {
  margin-top: 8px;
  font-size: clamp(30px, 4vw, 54px);
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  padding: 26px;
}

.bubble {
  max-width: min(760px, 88%);
  padding: 15px 17px;
  border-radius: 20px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.bubble.user {
  align-self: flex-end;
  background: var(--ink);
  color: white;
  border-bottom-right-radius: 6px;
}

.bubble.assistant {
  align-self: flex-start;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}

.chat-input {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.chat-input textarea {
  min-height: 58px;
  resize: vertical;
}

.upload-button {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  align-self: end;
  margin: 0;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: #fffdf8;
  color: var(--ink);
  font-size: 28px;
  font-weight: 800;
  cursor: pointer;
}

.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px 0;
  border-top: 1px solid var(--line);
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(15, 81, 50, 0.1);
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

.attachment-chip button {
  min-height: 22px;
  padding: 0 7px;
  border: 0;
  background: transparent;
  color: inherit;
}

.chat-settings {
  align-self: start;
  position: sticky;
  top: 20px;
}

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

.key-row button {
  min-width: 110px;
}

.key-status {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.dev-info {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.7);
}

.dev-info summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
}

.dev-info[open] summary {
  margin-bottom: 10px;
}

.ok-text {
  color: var(--brand);
}

.error-text {
  color: var(--danger);
}

@media (max-width: 900px) {
  .hero,
  .grid,
  .provider-grid,
  .metric-row,
  .dash,
  .chat-shell,
  .chat-input,
  .key-row,
  .site-footer {
    grid-template-columns: 1fr;
  }

  .site-footer nav {
    justify-content: flex-start;
  }

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