:root {
  --bg: #f6f2e8;
  --panel: rgba(255, 252, 246, 0.88);
  --ink: #1f2933;
  --muted: #52606d;
  --accent: #0f766e;
  --accent-2: #d97706;
  --danger: #b42318;
  --border: rgba(31, 41, 51, 0.12);
  --shadow: 0 20px 60px rgba(68, 48, 24, 0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(217, 119, 6, 0.18), transparent 28%),
    linear-gradient(180deg, #f9f5ee 0%, var(--bg) 100%);
}

.shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

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

.auth-shell.visible {
  display: grid;
}

.auth-card {
  width: min(520px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 26px;
}

.auth-title {
  max-width: none;
  font-size: clamp(2rem, 5vw, 3rem);
}

.hero {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.eyebrow, .disclaimer {
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  font-size: 0.85rem;
}
.small { font-size: 0.95rem; }

h1, h2, h3 { margin: 0 0 12px; }
h1 { font-size: clamp(2.2rem, 6vw, 4.4rem); line-height: 0.95; max-width: 12ch; }
.subtitle { max-width: 65ch; color: var(--muted); }

.hero-card,
.panel,
.metric,
.entry {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero-card, .panel { padding: 20px; }
.hero-card strong { display: block; font-size: 1.2rem; margin: 8px 0; }
.hero-card span { color: var(--muted); line-height: 1.5; }

.cards,
.grid {
  display: grid;
  gap: 18px;
}

.cards {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 18px;
}

.metric {
  padding: 18px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric span { color: var(--muted); }
.metric strong { font-size: 1.6rem; }

.grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

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

.stack {
  display: grid;
  gap: 12px;
}

.template-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 14px;
}

.template-links a {
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.5);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
}

.template-links a:hover {
  border-color: rgba(15, 118, 110, 0.4);
  background: rgba(15, 118, 110, 0.08);
}

input, select, textarea, button {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  font: inherit;
}

textarea { min-height: 88px; resize: vertical; }
button {
  background: linear-gradient(135deg, var(--accent) 0%, #155e75 100%);
  color: white;
  cursor: pointer;
  border: none;
  font-weight: 700;
}

.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--border);
}

.danger {
  background: #fff4f2;
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.16);
  max-width: 100px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox input {
  width: auto;
  margin: 0;
}

.entry {
  padding: 14px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.entry p,
#advisor p {
  margin: 0 0 8px;
  line-height: 1.45;
}

.status-line,
.llm-response,
.mono {
  font-family: "IBM Plex Mono", monospace;
}

.status-line {
  color: var(--muted);
  min-height: 1.2rem;
}

.llm-response {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  line-height: 1.5;
}

.llm-text {
  white-space: pre-wrap;
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.user-row {
  display: flex;
  gap: 20px;
  align-items: start;
  justify-content: space-between;
}

.user-controls {
  min-width: 140px;
  text-align: right;
}

#logout-button {
  margin-top: 8px;
}

.empty { color: var(--muted); }

@media (max-width: 900px) {
  .hero,
  .grid,
  .lists {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100% - 20px, 1200px);
    padding-top: 20px;
  }

  .user-row {
    flex-direction: column;
  }

  .user-controls {
    text-align: left;
  }
}
