:root {
  --bg: #f4efe5;
  --bg-soft: #fbf8f2;
  --panel: rgba(255, 252, 246, 0.9);
  --panel-strong: rgba(255, 253, 249, 0.96);
  --ink: #243041;
  --muted: #5e6c7b;
  --accent: #0f766e;
  --accent-deep: #155e75;
  --accent-2: #d97706;
  --danger: #b42318;
  --border: rgba(36, 48, 65, 0.1);
  --border-strong: rgba(36, 48, 65, 0.16);
  --shadow: 0 18px 45px rgba(71, 52, 31, 0.1);
  --shadow-soft: 0 10px 24px rgba(71, 52, 31, 0.06);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { 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.13), transparent 26%),
    radial-gradient(circle at top right, rgba(217, 119, 6, 0.14), transparent 24%),
    linear-gradient(180deg, #faf7f1 0%, var(--bg) 100%);
}

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

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

.topbar-brand {
  flex: 1 1 auto;
  min-width: 260px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.dev-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c2d12 0%, #b45309 100%);
  color: #fffaf0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 10px 24px rgba(124, 45, 18, 0.2);
}

.topbar-dev-badge {
  margin-bottom: 12px;
}

.auth-dev-badge {
  margin-bottom: 16px;
}

.auth-brand-lockup {
  margin-bottom: 10px;
}

.site-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(36, 48, 65, 0.12);
  flex: 0 0 auto;
}

.topbar-controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

.control-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-soft);
}

.brand-title {
  max-width: none;
  margin-bottom: 0;
  letter-spacing: -0.03em;
  font-size: clamp(1.2rem, 1.8vw, 1.55rem);
  line-height: 1.2;
  color: var(--muted);
  font-weight: 600;
}

.view-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-chip {
  width: auto;
  border-radius: 999px;
  padding: 10px 18px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  font-weight: 600;
}

.nav-chip.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: white;
  border-color: transparent;
}

.account-chip {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: none;
  padding: 6px 6px 6px 12px;
}

.account-chip .eyebrow {
  margin: 0;
  white-space: nowrap;
  font-size: 0.95rem;
}

.account-chip #logout-button {
  margin-top: 0;
  width: auto;
  min-width: 104px;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

.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-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 28px;
}

#login-links {
  margin-top: 14px;
}

.auth-links {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.auth-links.single {
  justify-content: flex-start;
}

.link-button {
  width: auto;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-button:hover {
  color: #155e75;
}

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

.hero {
  margin-bottom: 42px;
}

.overview-hero {
  display: flex;
  justify-content: center;
}

.hero-copy {
  width: min(100%, 1200px);
  max-width: none;
  margin: 0 auto;
  padding: 50px 0 34px;
}

.hero-title {
  font-size: clamp(3.3rem, 6.2vw, 5.7rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
  max-width: 16ch;
  margin-bottom: 22px;
}

.hero-subtitle {
  max-width: 60ch;
  font-size: 1.18rem;
  line-height: 1.6;
}

.section-kicker {
  margin: 0 0 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.trust-strip {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 28px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--border);
}

#overview-view {
  display: grid;
  gap: 0;
}

.trust-label {
  font-weight: 700;
  color: var(--ink);
}

.trust-copy {
  color: var(--muted);
}

.overview-grid {
  align-items: start;
}

.assistant-panel,
.workspace-intro {
  min-height: 100%;
}

.assistant-panel {
  display: grid;
  gap: 14px;
}

.assistant-panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.assistant-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assistant-suggestion {
  width: auto;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: none;
  font-weight: 500;
}

.assistant-suggestion:hover {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.28);
}

.assistant-thread {
  display: grid;
  gap: 14px;
  min-height: 340px;
  max-height: 620px;
  overflow-y: auto;
  padding: 8px 4px 4px;
}

.chat-message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.chat-message.user {
  justify-content: flex-end;
}

.chat-message.user .chat-avatar {
  order: 2;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: white;
}

.chat-message.user .chat-bubble {
  order: 1;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(21, 94, 117, 0.16));
  border-color: rgba(15, 118, 110, 0.16);
}

.chat-avatar {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(36, 48, 65, 0.08);
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  font-weight: 600;
}

.chat-avatar-image {
  padding: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
}

.chat-avatar-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.chat-bubble {
  flex: 1 1 auto;
  max-width: min(92%, 700px);
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  box-shadow: 0 12px 24px rgba(71, 52, 31, 0.05);
}

.chat-label {
  margin: 0 0 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  color: var(--muted);
}

.chat-bubble p {
  margin: 0;
  line-height: 1.55;
}

.chat-bubble p + p {
  margin-top: 8px;
}

.welcome-message .chat-bubble {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(248, 244, 237, 0.94));
}

.assistant-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--border);
}

.assistant-composer textarea {
  min-height: 72px;
  margin: 0;
}

.assistant-composer button {
  width: auto;
  min-width: 120px;
  height: fit-content;
}

.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.4rem, 6vw, 4.7rem); line-height: 0.94; max-width: 12ch; }
h2 { font-size: clamp(1.5rem, 2.2vw, 2rem); letter-spacing: -0.035em; }
h3 { font-size: 1.05rem; letter-spacing: -0.02em; }
.subtitle { max-width: 58ch; color: var(--muted); line-height: 1.55; }

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

.panel { padding: 20px 20px 22px; }

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

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

.metric {
  padding: 16px 16px 18px;
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(251, 246, 238, 0.94));
}

.metric span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.3;
}

.metric strong {
  font-size: clamp(1.55rem, 2vw, 1.85rem);
  letter-spacing: -0.04em;
}

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

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

.workspace-intro {
  margin-bottom: 2px;
}

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

.auth-form:not(.active) {
  display: none;
}

.auth-form.active {
  display: grid;
}

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

.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: var(--radius-md);
  border: 1px solid rgba(36, 48, 65, 0.12);
  padding: 12px 14px;
  font: inherit;
}

input,
select,
textarea {
  background: rgba(255, 255, 255, 0.76);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.08);
}

textarea { min-height: 96px; resize: vertical; }
button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: white;
  cursor: pointer;
  border: none;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.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;
}

.entry-actions,
.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.entry-actions {
  flex: 0 0 auto;
}

.entry-actions .secondary,
.entry-actions .danger,
.form-actions button {
  width: auto;
  min-width: 110px;
}

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

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

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

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

#advisor h3,
.panel h2 {
  margin-bottom: 12px;
}

#advisor .disclaimer {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

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

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

.assistant-response-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.assistant-meta-line {
  margin: 0;
}

.assistant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.assistant-action:hover {
  border-color: rgba(15, 118, 110, 0.4);
  background: rgba(15, 118, 110, 0.08);
}

.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: 0;
  width: auto;
  min-width: 112px;
}

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

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

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

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

  .topbar,
  .user-row,
  .topbar-controls,
  .control-cluster {
    flex-direction: column;
    align-items: start;
  }

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

  .assistant-composer button,
  .assistant-suggestion,
  .form-actions button {
    width: 100%;
  }

  .topbar-controls {
    width: 100%;
  }

  .control-cluster {
    width: 100%;
    border-radius: var(--radius-lg);
  }

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

  .view-nav,
  .account-chip {
    width: 100%;
  }

  .account-chip {
    border-radius: var(--radius-lg);
    justify-content: space-between;
  }

  .hero-copy {
    padding-right: 0;
  }

  .brand-title,
  .hero-title {
    max-width: none;
  }
}
