:root {
  color-scheme: light dark;
  --bg: #f5f4f1;
  --surface: #ffffff;
  --fg: #1a1a1a;
  --fg-muted: #6b6b68;
  --bubble-user: #1f3a5f;
  --bubble-user-fg: #ffffff;
  --bubble-bot: #ffffff;
  --bubble-bot-fg: #1a1a1a;
  --border: #e4e2dc;
  --accent: #1f3a5f;
  --accent-2: #a97e3f;
  --danger: #c0432f;
  --shadow: 0 1px 2px rgba(20, 20, 15, 0.04), 0 8px 24px rgba(20, 20, 15, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14151a;
    --surface: #1d1f26;
    --fg: #ececec;
    --fg-muted: #9a9a9d;
    --bubble-user: #3a5c8c;
    --bubble-bot: #21232b;
    --bubble-bot-fg: #ececec;
    --border: #33353f;
    --accent: #5b83b8;
    --accent-2: #c79a53;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1 {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

[hidden] {
  display: none !important;
}

/* ---------- gates (sign in, onboarding, paywall) ---------- */

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 20% 15%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 45%),
    radial-gradient(circle at 85% 80%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 40%),
    var(--bg);
}

.gate.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(4px);
}

.mark {
  font-size: 2.25rem;
  line-height: 1;
  margin-bottom: 0.75rem;
}

.mark.small {
  font-size: 1.5rem;
  margin: 0;
  flex-shrink: 0;
}

.card {
  max-width: 420px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.1rem;
  padding: 2rem 1.75rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.card.wide {
  max-width: 480px;
}

.card h1 {
  font-size: 1.4rem;
  margin: 0 0 0.6rem;
}

.card p {
  font-size: 0.875rem;
  color: var(--fg-muted);
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

.card p strong {
  color: var(--fg);
}

input, select {
  width: 100%;
  min-width: 0;
  border-radius: 0.6rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  padding: 0.65rem 0.85rem;
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.row-form {
  display: flex;
  gap: 0.5rem;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  text-align: left;
}

.stack-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg);
}

.stack-form button[type="submit"] {
  padding: 0.7rem;
  border-radius: 0.6rem;
  margin-top: 0.25rem;
}

.row-form button {
  padding: 0 1.25rem;
  border-radius: 0.6rem;
  flex-shrink: 0;
}

.form-error {
  color: var(--danger);
  font-size: 0.8rem !important;
  margin: 0.85rem 0 0 !important;
  font-weight: 500;
}

.dev-note {
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
  border-radius: 0.5rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem !important;
}

.dev-note a {
  color: var(--accent);
  font-weight: 600;
}

.card > button, .card div > button {
  margin-top: 0.4rem;
}

.card #paywall-subscribe {
  width: 100%;
  padding: 0.7rem;
  border-radius: 0.6rem;
  margin-bottom: 0.4rem;
}

button.ghost {
  background: none;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.6rem;
}

button.ghost:hover:not(:disabled) {
  color: var(--fg);
  border-color: var(--accent);
}

button.small-btn {
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  border-radius: 1rem;
}

/* ---------- app shell ---------- */

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  max-width: 720px;
  margin: 0 auto;
}

header h1 {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
}

header p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.4;
}

/* ---------- chat ---------- */

.chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.empty-state {
  margin: auto 0;
  text-align: center;
  padding: 2rem 0;
}

.empty-title {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: 1.1rem;
  margin: 0 0 0.3rem;
}

.empty-sub {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin: 0 0 1.25rem;
}

.chip-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.chip {
  font: inherit;
  font-size: 0.82rem;
  max-width: 420px;
  text-align: left;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.chip:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.bubble {
  max-width: 78%;
  padding: 0.65rem 0.95rem;
  border-radius: 1rem;
  line-height: 1.45;
  font-size: 0.93rem;
  white-space: pre-wrap;
  animation: rise 0.18s ease-out;
}

.bubble.user {
  align-self: flex-end;
  background: var(--bubble-user);
  color: var(--bubble-user-fg);
  border-bottom-right-radius: 0.25rem;
}

.bubble.bot {
  align-self: flex-start;
  background: var(--bubble-bot);
  color: var(--bubble-bot-fg);
  border: 1px solid var(--border);
  border-bottom-left-radius: 0.25rem;
  box-shadow: var(--shadow);
}

.bubble.answer {
  border-left: 3px solid var(--accent-2);
}

.answer-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 0.35rem;
}

.answer-tag a {
  color: inherit;
  text-decoration: none;
}

.answer-tag a:hover {
  text-decoration: underline;
}

.answer-text {
  white-space: pre-wrap;
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  padding: 0.15rem 0;
}

.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  animation: bounce 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-3px); opacity: 0.9; }
}

.result-card {
  align-self: flex-start;
  max-width: 78%;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  background: var(--surface);
  border-radius: 0.7rem;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  animation: rise 0.18s ease-out;
}

.result-card .case-name {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-weight: 600;
  font-size: 0.98rem;
  margin-bottom: 0.2rem;
}

.result-card .meta {
  color: var(--fg-muted);
  font-size: 0.78rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.result-card .snippet {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.45;
  margin-bottom: 0.65rem;
}

.result-card .summary {
  font-size: 0.85rem;
  line-height: 1.5;
  background: color-mix(in srgb, var(--accent-2) 10%, transparent);
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.65rem;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.result-card a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.result-card a:hover {
  text-decoration: underline;
}

.summarize-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: 1rem;
  flex-shrink: 0;
}

.summarize-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.query-tag {
  align-self: flex-start;
  font-size: 0.72rem;
  color: var(--fg-muted);
  padding: 0 0.2rem;
  font-style: italic;
}


/* ---------- country tabs ---------- */

#tabs {
  display: flex;
  gap: 0.35rem;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 0.75rem 1.5rem 0;
}

.tab {
  background: none;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.35rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 500;
}

.tab:hover {
  color: var(--fg);
  border-color: var(--accent);
}

.tab[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

#panels {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.source-note {
  align-self: flex-start;
  font-size: 0.7rem;
  color: var(--fg-muted);
  padding: 0 0.2rem;
}


/* ---------- header actions, usage pill, menu ---------- */

.brand-text {
  flex: 1;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 1rem;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  white-space: nowrap;
}

.pill.low {
  background: color-mix(in srgb, var(--danger) 15%, transparent);
  color: var(--danger);
}

.menu-wrap {
  position: relative;
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  box-shadow: var(--shadow);
  padding: 0.4rem;
  z-index: 20;
}

.menu-email {
  font-size: 0.75rem;
  color: var(--fg-muted);
  padding: 0.4rem 0.6rem;
  word-break: break-all;
}

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  color: var(--fg);
  font-weight: 500;
  font-size: 0.82rem;
  padding: 0.5rem 0.6rem;
  border-radius: 0.45rem;
}

.menu-item:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.menu-item.danger {
  color: var(--danger);
}

/* ---------- saved chats drawer ---------- */

#history {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 40;
  display: flex;
  flex-direction: column;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

#history-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.history-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0;
}

.history-open {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-align: left;
  background: none;
  color: var(--fg);
  font-weight: 500;
  padding: 0.55rem 0.6rem;
  border-radius: 0.55rem;
}

.history-open:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.history-title {
  width: 100%;
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  font-size: 0.7rem;
  color: var(--fg-muted);
  font-weight: 400;
}

.disclaimer {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem 0.8rem;
  font-size: 0.68rem;
  color: var(--fg-muted);
  text-align: center;
}

/* ---------- composer ---------- */

#composer {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  padding: 0.9rem 1.5rem 1.25rem;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

#input {
  flex: 1;
  resize: none;
  border-radius: 1.1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  padding: 0.7rem 1rem;
  font: inherit;
  max-height: 8rem;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}

#input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

button {
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.1s;
}

button:hover:not(:disabled) {
  opacity: 0.92;
}

button:active:not(:disabled) {
  transform: scale(0.97);
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

#composer button {
  width: 2.6rem;
  height: 2.6rem;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 560px) {
  .bubble, .result-card {
    max-width: 88%;
  }
  header, .chat, #composer, #tabs {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

.menu-plan {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0 0.6rem 0.4rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 5.5rem;
  transform: translateX(-50%);
  max-width: min(440px, 92vw);
  background: var(--fg);
  color: var(--bg);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.65rem 1rem;
  border-radius: 0.7rem;
  box-shadow: var(--shadow);
  z-index: 60;
  text-align: center;
}

.toast.error {
  background: var(--danger);
  color: #fff;
}

/* ---------- landing page and document pages ---------- */

html {
  scroll-behavior: smooth;
}

body {
  height: auto;
  min-height: 100vh;
}

.landing {
  background: var(--bg);
}

.land-wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.land-wrap.narrow {
  max-width: 720px;
}

.land-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 0;
}

.land-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.land-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--fg);
  text-decoration: none;
}

a.linkbtn {
  text-decoration: none;
  display: inline-block;
}

.land-hero {
  padding: 5rem 0 4rem;
  text-align: center;
  background:
    radial-gradient(circle at 18% 10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 45%),
    radial-gradient(circle at 85% 70%, color-mix(in srgb, var(--accent-2) 11%, transparent), transparent 40%);
}

.land-hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.2rem);
  line-height: 1.12;
  margin: 0 auto 1.1rem;
  max-width: 17ch;
}

.lead {
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--fg-muted);
  max-width: 40rem;
  margin: 0 auto 1.8rem;
}

.cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

button.cta {
  font-size: 1rem;
  padding: 0.85rem 1.6rem;
  border-radius: 0.8rem;
}

.cta-link {
  color: var(--fg-muted);
  font-size: 0.92rem;
  font-weight: 500;
}

.fine {
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin: 1rem 0 0;
}

.fine.center {
  text-align: center;
}

.fine a, .land-footer a, .doc a, .land-card a, details a {
  color: var(--accent);
}

.land-section {
  padding: 4rem 0;
}

.land-section.alt {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.land-section h2 {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: 1.7rem;
  text-align: center;
  margin: 0 0 2rem;
}

.land-grid {
  display: grid;
  gap: 1.1rem;
}

.land-grid.three {
  grid-template-columns: repeat(3, 1fr);
}

.land-grid.two {
  grid-template-columns: repeat(2, 1fr);
}

.land-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.4rem;
  box-shadow: var(--shadow);
}

.land-section.alt .land-card {
  background: var(--bg);
}

.land-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1.02rem;
}

.land-card p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-2) 20%, transparent);
  color: var(--accent-2);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.7rem;
}

.pricing .land-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pricing .land-card.featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
}

.price {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: 2.2rem !important;
  color: var(--fg) !important;
  margin: 0.1rem 0 !important;
}

.price span {
  font-size: 0.95rem;
  color: var(--fg-muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pricing ul {
  list-style: none;
  padding: 0;
  margin: 0.2rem 0 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.92rem;
  color: var(--fg);
  flex: 1;
}

.pricing li::before {
  content: "✓ ";
  color: var(--accent-2);
  font-weight: 700;
}

details {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.7rem;
}

details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
}

details p {
  margin: 0.7rem 0 0;
  color: var(--fg-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.land-footer {
  padding: 2.2rem 0 2.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--fg-muted);
  line-height: 1.6;
}

.land-footer p {
  margin: 0 0 0.6rem;
}

.foot-links a {
  margin: 0 0.15rem;
}

/* legal / document pages */
.doc {
  max-width: 740px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
  line-height: 1.7;
  font-size: 0.95rem;
}

.doc h1 {
  font-size: 2rem;
  margin: 0 0 0.3rem;
}

.doc h2 {
  font-size: 1.1rem;
  margin: 2rem 0 0.5rem;
}

.doc p, .doc li {
  color: var(--fg);
}

.doc ul {
  padding-left: 1.2rem;
}

.doc .updated {
  color: var(--fg-muted);
  font-size: 0.82rem;
  margin: 0 0 1.5rem;
}

.card .fine {
  margin: 0.9rem 0 0.2rem;
}

#login-home {
  margin-top: 0.6rem;
}

@media (max-width: 760px) {
  .land-grid.three, .land-grid.two {
    grid-template-columns: 1fr;
  }
  .land-hero {
    padding: 3.2rem 0 2.8rem;
  }
}

/* ---------- marketing page (index.html) ---------- */

a.cta, a.btn-ghost {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  font-weight: 600;
  border-radius: 0.8rem;
}

a.cta {
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  padding: 0.85rem 1.6rem;
  transition: opacity 0.15s, transform 0.1s;
}

a.cta:hover {
  opacity: 0.92;
}

a.cta:active {
  transform: scale(0.98);
}

a.btn-ghost {
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 0.75rem 1.4rem;
  font-size: 0.95rem;
}

a.btn-ghost:hover {
  border-color: var(--accent);
}

.land-links {
  display: flex;
  gap: 1.6rem;
  margin: 0 auto 0 2.4rem;
}

.land-links a {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
}

.land-links a:hover {
  color: var(--fg);
}

a.nav-cta {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.5rem 1.1rem;
  border-radius: 1.2rem;
  white-space: nowrap;
}

a.nav-cta:hover {
  opacity: 0.92;
}

.marketing .land-hero {
  text-align: left;
  padding: 4.5rem 0 4rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 3rem;
  align-items: center;
}

.marketing .land-hero h1 {
  margin: 0 0 1.1rem;
  max-width: 16ch;
}

.marketing .lead {
  margin: 0 0 1.8rem;
}

.marketing .cta-row {
  justify-content: flex-start;
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 0 0 0.9rem;
}

.preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06), 0 24px 48px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.preview-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 60%, var(--surface));
}

.preview-bar span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border);
}

.preview-bar em {
  margin-left: auto;
  font-size: 0.7rem;
  font-style: normal;
  color: var(--fg-muted);
}

.preview-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.82rem;
}

.pv-user {
  align-self: flex-end;
  max-width: 85%;
  background: var(--bubble-user);
  color: #fff;
  padding: 0.55rem 0.8rem;
  border-radius: 0.9rem 0.9rem 0.25rem 0.9rem;
  line-height: 1.4;
}

.pv-bot {
  align-self: flex-start;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.5rem 0.8rem;
  border-radius: 0.9rem 0.9rem 0.9rem 0.25rem;
}

.pv-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: 0.6rem;
  padding: 0.7rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.pv-card strong {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: 0.88rem;
}

.pv-meta {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--fg-muted);
}

.pv-card p {
  margin: 0;
  color: var(--fg-muted);
  line-height: 1.45;
  font-size: 0.78rem;
}

.pv-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.2rem;
}

.pv-actions i {
  font-style: normal;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.76rem;
}

.pv-actions b {
  font-weight: 500;
  font-size: 0.7rem;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: 1rem;
}

.land-final {
  text-align: center;
  padding: 4.5rem 0;
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%);
}

.land-final h2 {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: 1.8rem;
  margin: 0 0 0.5rem;
}

.land-final p {
  color: var(--fg-muted);
  margin: 0 0 1.6rem;
}

@media (max-width: 860px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2.2rem;
  }
  .land-links {
    display: none;
  }
  .land-nav-inner {
    justify-content: space-between;
  }
}

/* ---------- signed-in layout: sidebar + main ---------- */

#app {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}

#sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: width 0.22s ease, transform 0.22s ease;
}

.sb-inner {
  width: 280px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0.85rem 0.7rem 0.7rem;
  gap: 0.45rem;
}

#app.sidebar-collapsed #sidebar {
  width: 0;
  border-right-color: transparent;
}

#main {
  flex: 1;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem 0.2rem;
}

.topbar #tabs {
  max-width: none;
  width: auto;
  margin: 0;
  padding: 0;
}

button.icon-btn {
  width: 2.2rem;
  height: 2.2rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  color: var(--fg-muted);
  border-radius: 0.6rem;
  padding: 0;
}

button.icon-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--fg);
  opacity: 1;
}

#sb-open {
  display: none;
}

#app.sidebar-collapsed #sb-open {
  display: inline-flex;
}

.sb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.2rem 0.25rem 0.4rem;
}

.sb-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-weight: 600;
  font-size: 1.05rem;
}

button.sb-new {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  background: none;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.6rem 0.8rem;
  font-size: 0.88rem;
  font-weight: 600;
}

button.sb-new:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-color: var(--accent);
  opacity: 1;
}

.sb-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 0.8rem 0.55rem 0.1rem;
}

.chat-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 -0.2rem;
  padding: 0 0.2rem;
}

.chat-group-label {
  font-size: 0.68rem;
  color: var(--fg-muted);
  padding: 0.75rem 0.55rem 0.2rem;
}

.chat-empty {
  font-size: 0.8rem;
  color: var(--fg-muted);
  padding: 0.5rem 0.55rem;
  margin: 0;
  line-height: 1.5;
}

.chat-item {
  display: flex;
  align-items: center;
  border-radius: 0.6rem;
}

.chat-item:hover,
.chat-item.active {
  background: color-mix(in srgb, var(--accent) 13%, transparent);
}

button.chat-open {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  color: var(--fg);
  text-align: left;
  font-weight: 500;
  font-size: 0.84rem;
  padding: 0.5rem 0.6rem;
  border-radius: 0.6rem;
}

button.chat-open:hover:not(:disabled) {
  opacity: 1;
}

.chat-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-badge {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  padding: 0.05rem 0.3rem;
  flex-shrink: 0;
}

button.chat-del {
  width: 1.7rem;
  height: 1.7rem;
  margin-right: 0.2rem;
  flex-shrink: 0;
  background: none;
  color: var(--fg-muted);
  border-radius: 0.4rem;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0;
}

.chat-item:hover button.chat-del,
.chat-item.active button.chat-del {
  opacity: 1;
}

button.chat-del:hover:not(:disabled) {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  opacity: 1;
}

@media (hover: none) {
  button.chat-del {
    opacity: 1;
  }
}

.sb-bottom {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.usage {
  padding: 0 0.4rem;
}

.usage-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.usage-row strong {
  font-size: 0.98rem;
  color: var(--fg);
}

.usage-bar {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fg) 12%, transparent);
  overflow: hidden;
  margin: 0.45rem 0 0.4rem;
}

#usage-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.4s ease, background 0.3s;
}

.usage.warn #usage-fill {
  background: #d9992b;
}

.usage.danger #usage-fill {
  background: var(--danger);
}

.usage-reset {
  font-size: 0.72rem;
  color: var(--fg-muted);
}

button.acct-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  background: none;
  color: var(--fg);
  padding: 0.5rem 0.55rem;
  border-radius: 0.75rem;
  text-align: left;
  font-weight: 500;
}

button.acct-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  opacity: 1;
}

.avatar {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.acct-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.acct-name {
  font-size: 0.86rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acct-plan {
  font-size: 0.72rem;
  color: var(--fg-muted);
}

.acct-chev {
  display: flex;
  color: var(--fg-muted);
}

.menu.menu-up {
  top: auto;
  bottom: calc(100% + 0.45rem);
  left: 0;
  right: 0;
  min-width: 0;
}

.sb-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 30;
}

@media (max-width: 800px) {
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 40;
    box-shadow: var(--shadow);
  }
  #app.sidebar-collapsed #sidebar {
    width: 280px;
    transform: translateX(-100%);
    border-right-color: var(--border);
    box-shadow: none;
  }
  #sb-open,
  #app.sidebar-collapsed #sb-open {
    display: inline-flex;
  }
  .topbar {
    padding: 0.6rem 0.8rem 0.2rem;
  }
}

.nopw {
  margin: 0 0 1rem !important;
  line-height: 1.5;
  text-align: left;
}

.nopw strong {
  color: var(--fg);
}

.resend-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

a.ghost.small-btn {
  background: none;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: 1rem;
  text-decoration: none;
}

a.ghost.small-btn:hover {
  color: var(--fg);
  border-color: var(--accent);
}

/* ---------- judgments ---------- */

.bubble.missing {
  max-width: 78%;
}

.missing-text {
  margin: 0 0 0.7rem;
  line-height: 1.5;
}

.missing-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.up-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

button.up-btn, button.up-go {
  background: var(--accent);
  color: #fff;
  border-radius: 0.7rem;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
}

button.up-go {
  margin-top: 0.7rem;
}

button.up-link {
  background: none;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.3rem 0;
  text-decoration: underline;
}

.up-paste {
  width: 100%;
  margin-top: 0.7rem;
  resize: vertical;
  border-radius: 0.6rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  padding: 0.6rem 0.75rem;
  font: inherit;
  font-size: 0.85rem;
}

.up-status {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.up-status.err {
  color: var(--danger);
  font-weight: 500;
}

.up-links {
  margin: 0.8rem 0 0;
  font-size: 0.72rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

.up-links a {
  color: var(--accent);
}

.jd-card {
  align-self: flex-start;
  max-width: 88%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: 0.8rem;
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  line-height: 1.55;
  animation: rise 0.18s ease-out;
}

.jd-title {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: 1.15rem;
  margin: 0 0 0.2rem;
}

.jd-meta {
  font-size: 0.74rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.jd-src {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  font-size: 0.78rem;
}

.jd-badge {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  border-radius: 1rem;
  padding: 0.15rem 0.6rem;
  font-weight: 600;
  font-size: 0.72rem;
}

.jd-src a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.jd-sec {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 1.1rem 0 0.3rem;
}

.jd-p {
  margin: 0;
}

.jd-ratio {
  background: color-mix(in srgb, var(--accent-2) 11%, transparent);
  border-radius: 0.5rem;
  padding: 0.6rem 0.8rem;
}

.jd-list {
  margin: 0;
  padding-left: 1.1rem;
}

.jd-list li {
  margin-bottom: 0.3rem;
}

blockquote.jd-quote {
  margin: 0.5rem 0 0;
  padding: 0.1rem 0 0.1rem 0.85rem;
  border-left: 2px solid var(--accent);
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: 0.9rem;
}

blockquote.jd-quote p {
  margin: 0;
  line-height: 1.5;
}

blockquote.jd-quote cite {
  display: block;
  margin-top: 0.2rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-style: normal;
  font-size: 0.72rem;
  color: var(--fg-muted);
}

.jd-foot {
  margin-top: 1rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--fg-muted);
}

@media (max-width: 560px) {
  .jd-card, .bubble.missing {
    max-width: 94%;
  }
}

.missing-alt {
  margin: 0 0 0.8rem;
  padding: 0.6rem 0.8rem;
  background: color-mix(in srgb, var(--accent-2) 11%, transparent);
  border-radius: 0.5rem;
  font-size: 0.84rem;
  line-height: 1.5;
}

.missing-alt p {
  margin: 0 0 0.3rem;
}
