/* Wagent app — match marketing vibe lightly */
:root {
  --bg: #f4f7f5;
  --bg-alt: #e8efeb;
  --ink: #0b1f1a;
  --ink-muted: #3d534c;
  --line: #c5d4cc;
  --brand: #0f6b4c;
  --brand-deep: #0a4d38;
  --accent: #c4a35a;
  --accent-soft: #f3ead2;
  --panel: #ffffff;
  --shadow: 0 18px 50px rgba(11, 31, 26, 0.12);
  --radius: 16px;
  --font: "DM Sans", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --max: 760px;
}

*, *::before, *::after { box-sizing: border-box; }
/* Author display rules must not override the HTML hidden attribute */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 10% -10%, #d9ebe2 0%, transparent 55%),
    radial-gradient(700px 360px at 100% 0%, var(--accent-soft) 0%, transparent 50%),
    var(--bg);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-deep); }
a:hover { color: var(--brand); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff;
  padding: 0.75rem 1rem; z-index: 100;
}
.skip-link:focus { left: 0; }

.wrap { width: min(100% - 2rem, var(--max)); margin-inline: auto; }

.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.header-inner {
  display: flex; align-items: center; gap: 0.85rem;
  min-height: 3.75rem;
}
.logo {
  display: inline-flex; align-items: center; gap: 0.55rem;
  text-decoration: none; color: var(--ink); font-weight: 700; letter-spacing: -0.02em;
}
.logo-mark {
  width: 1.35rem; height: 1.35rem; border-radius: 0.4rem;
  background: linear-gradient(145deg, var(--brand), #1a9b6c 55%, var(--accent));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}
.header-badge {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--brand-deep); background: var(--bg-alt); border: 1px solid var(--line);
  border-radius: 999px; padding: 0.2rem 0.55rem;
}
.header-right { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.user-email { font-size: 0.875rem; color: var(--ink-muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; padding: 0.7rem 1.2rem; font-weight: 600;
  font-size: 0.95rem; border: 1px solid transparent; cursor: pointer;
  text-decoration: none; transition: transform 0.15s ease, background 0.15s ease;
  font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.875rem; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-deep); color: #fff; }
.btn-ghost {
  background: transparent; color: var(--ink); border-color: var(--line);
}
.btn-ghost:hover { background: var(--panel); }

.app-main { padding: 2.5rem 0 4rem; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}
.login-card { max-width: 440px; margin-inline: auto; }
.eyebrow {
  margin: 0 0 0.5rem; font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand);
}
h1 {
  margin: 0 0 0.5rem; font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.85rem, 4vw, 2.35rem); letter-spacing: -0.02em;
}
.lede { margin: 0 0 1.5rem; color: var(--ink-muted); }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 500; font-size: 0.9rem; }
.field input, .composer textarea {
  font: inherit; padding: 0.75rem 0.9rem; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.field input:focus, .composer textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
  border-color: var(--brand);
}
.status { min-height: 1.25rem; font-size: 0.9rem; color: var(--ink-muted); margin: 1rem 0 0; }
.status.error { color: #8b2e2e; }
.status.ok { color: var(--brand-deep); }
.fine { margin: 1.5rem 0 0; font-size: 0.85rem; color: var(--ink-muted); }
.dogfood {
  margin-top: 1.25rem; padding: 1rem; border-radius: 12px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  font-size: 0.9rem;
}
.dogfood a { word-break: break-all; font-weight: 600; }

.chat-shell {
  flex-direction: column; gap: 1rem;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  min-height: min(70vh, 720px); overflow: hidden;
}
.chat-shell:not([hidden]) {
  display: flex;
}
.chat-header {
  padding: 1.25rem 1.5rem 0.75rem;
  border-bottom: 1px solid var(--line);
}
.chat-header h1 { font-size: 1.5rem; margin: 0; }
.chat-sub { margin: 0.25rem 0 0; color: var(--ink-muted); font-size: 0.875rem; }

.transcript {
  flex: 1; overflow-y: auto; padding: 1rem 1.5rem;
  display: flex; flex-direction: column; gap: 0.85rem;
  background: linear-gradient(180deg, #fbfcfb, var(--panel));
}
.msg {
  max-width: 85%; padding: 0.75rem 1rem; border-radius: 14px;
  font-size: 0.95rem; white-space: pre-wrap; word-break: break-word;
}
.msg.user {
  align-self: flex-end; background: var(--brand); color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.assistant {
  align-self: flex-start; background: var(--bg-alt); color: var(--ink);
  border: 1px solid var(--line); border-bottom-left-radius: 4px;
}
.msg.system {
  align-self: center; background: transparent; color: var(--ink-muted);
  font-size: 0.85rem; max-width: 100%; text-align: center;
}
.msg .meta { display: block; font-size: 0.7rem; opacity: 0.75; margin-bottom: 0.25rem; }

.composer {
  display: grid; grid-template-columns: 1fr auto; gap: 0.75rem;
  padding: 1rem 1.5rem 1.25rem; border-top: 1px solid var(--line);
  align-items: end;
}
.composer textarea { resize: vertical; min-height: 3rem; max-height: 8rem; }

#chat-status { margin: 0 1.5rem 1rem; }

@media (max-width: 560px) {
  .user-email { display: none; }
  .composer { grid-template-columns: 1fr; }
}
