
:root {
  --cream: hsl(36 30% 97%);
  --sand: hsl(36 25% 94%);
  --petro: hsl(178 42% 10%);
  --ink: hsl(178 42% 10%);
  --muted: hsl(178 18% 38%);
  --accent: hsl(168 56% 38%);
  --accent-on-deep: hsl(168 52% 64%);
  --card: #fff;
  --line: hsla(178, 42%, 10%, 0.10);
  --radius: 10px;
  --radius-tag: 7px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --font: "DM Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.45;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
.logo-alvo {
  height: 36px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
.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;
}
.gate[hidden],
#shell[hidden],
.gate-err[hidden],
.empty[hidden],
#hero-meta[hidden] { display: none !important; }

.gate { min-height: 100dvh; background: var(--cream); }
.auth-split {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1.05fr;
}
.auth-form {
  padding: 2.4rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
}
.auth-panel {
  background: var(--petro);
  min-height: 220px;
}
.eyebrow {
  margin: 1.4rem 0 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.auth-form h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.8rem, 4vw, 2.25rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-weight: 700;
}
.sub, .legal {
  margin: 0 0 1.2rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.legal { margin: 0.85rem 0 0; font-size: 0.8rem; }
.field { display: grid; gap: 0.35rem; margin-bottom: 0.85rem; }
.field label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input,
.filters select,
.filters input,
.ask-form input {
  font: inherit;
  padding: 11px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.75rem 0.7rem 1.1rem;
  border-radius: var(--radius);
  transition: transform 500ms var(--ease), background 500ms var(--ease);
}
.btn-ink { background: var(--petro); color: #F7F4EF; width: 100%; }
.btn-ico {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: hsl(168 52% 64% / 0.18);
  color: var(--accent-on-deep);
  font-size: 0.85rem;
  transition: transform 500ms var(--ease);
}
.btn-ink:hover { transform: scale(0.99); }
.btn-ink:hover .btn-ico { transform: translate(1px, -1px); }
.gate-err { margin: 0.8rem 0 0; color: #8a3d2a; font-size: 0.88rem; font-weight: 600; }

.mesa {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  background: var(--cream);
}
.mesa-main {
  min-width: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.hist {
  background: var(--sand);
  border-right: 1px solid var(--line);
  padding: 0.85rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
.hist-new {
  font: inherit;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--petro);
  color: #F7F4EF;
  cursor: pointer;
  text-align: left;
}
.hist-new:hover { background: hsl(178 42% 14%); }
.hist-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.hist-item {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.3;
  padding: 0.5rem 0.55rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.hist-item:hover { background: hsl(36 30% 97%); }
.hist-item[aria-current="true"] { background: #fff; }
.hist-item span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hist-item time {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.7rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.hist-empty {
  margin: 0.4rem 0.2rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.top {
  background: var(--cream);
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 1.15rem;
}
.top-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.9rem;
}
.top-copy { flex: 1; min-width: 0; }
.top-copy .eyebrow { margin: 0 0 0.1rem; }
.top-copy h1 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.top-cov {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  max-width: 16ch;
}
.top-list {
  margin: 0;
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid hsl(168 56% 38% / 0.35);
  padding-bottom: 1px;
}
.top-list:hover { color: var(--petro); border-bottom-color: var(--petro); }

.thread {
  flex: 1;
  overflow-y: auto;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 1.15rem 1.15rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.msg {
  max-width: 86%;
  padding: 0.8rem 0.95rem;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.4;
}
.msg p { margin: 0 0 0.55rem; }
.msg p:last-child { margin-bottom: 0; }
.msg.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}
.msg.user {
  align-self: flex-end;
  background: var(--petro);
  color: #F7F4EF;
}
.msg.pending { color: var(--muted); }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.7rem;
}
.chip {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-tag);
  border: 1px solid var(--line);
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
  transition: background 400ms var(--ease);
}
.chip:hover { background: var(--sand); }
.match-list { display: grid; gap: 0.45rem; margin-top: 0.7rem; }
.match-card {
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cream);
}
.match-card .stock-kicker { margin-bottom: 0.2rem; }
.match-card .stock-title { font-size: 0.95rem; }

.composer {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 0.7rem 1.15rem 1.1rem;
  background: var(--cream);
  border-top: 1px solid var(--line);
}
.ask-row { display: grid; grid-template-columns: 1fr auto; gap: 0.55rem; }
.ask-form .btn { width: auto; }

.stock-drawer {
  margin-top: 0.65rem;
  font-size: 0.84rem;
}
.stock-drawer summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  list-style: none;
}
.stock-drawer summary::-webkit-details-marker { display: none; }
.stock-drawer[open] summary { margin-bottom: 0.7rem; color: var(--ink); }

.filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
  padding: 0.9rem 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
@media (min-width: 800px) {
  .filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .auth-form { padding: 2.8rem 2.4rem; }
}
.filters label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.list-meta {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.empty {
  padding: 1.2rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}
.stock-list { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; max-height: 42vh; overflow-y: auto; }
.stock-card {
  display: grid;
  gap: 0.3rem;
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--line);
  transition: background 400ms var(--ease);
}
.stock-card:last-child { border-bottom: 0; }
.stock-card:hover { background: var(--sand); }
.stock-kicker {
  margin: 0;
  display: inline-flex;
  width: fit-content;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: var(--radius-tag);
  padding: 0.18rem 0.45rem;
}
.stock-title {
  margin: 0.15rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.stock-meta { margin: 0; font-size: 0.84rem; color: var(--muted); }
.stock-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.25rem;
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stock-stats span { color: var(--muted); font-weight: 500; }

@media (max-width: 767px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-panel { min-height: 140px; }
  .ask-row { grid-template-columns: 1fr; }
  .msg { max-width: 94%; }
  .mesa {
    grid-template-columns: 1fr;
  }
  .hist {
    min-height: 0;
    max-height: 28vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .mesa-main { min-height: 0; }
}
