/* Emptori Room — design tokens from APP_PRIMARY_PLAN §5A / site/index.html
   Keep in sync with marketing homepage values. */

:root {
  color-scheme: dark;
  --bg: #050608;
  --bg-2: #0a0c10;
  --bg-3: #101319;
  --fg: #f0f2f7;
  --muted: #8a93a3;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #4c7dff;
  --accent-glow: rgba(76, 125, 255, 0.45);
  --accent-2: #ffb454;
  --accent-2-glow: rgba(255, 180, 84, 0.35);
  --accent-fg: #ffffff;
  --frame: rgba(255, 255, 255, 0.03);
  --success: #00d4aa;
  --radius: 18px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --theme-color: #0b0d11;
  --nav-h: 64px;
  --bottom-nav-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Quieter ambient than marketing (long reading sessions) */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 15% 25%, rgba(76, 125, 255, 0.12) 0%, transparent 35%),
    radial-gradient(circle at 85% 15%, rgba(255, 180, 84, 0.06) 0%, transparent 30%),
    radial-gradient(circle at 50% 85%, rgba(76, 125, 255, 0.07) 0%, transparent 35%),
    var(--bg);
  pointer-events: none;
}

.grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 0%, transparent 75%);
  opacity: 0.35;
  pointer-events: none;
}

/* Dense list views can hide grid via body.no-grid */
body.no-grid .grid {
  display: none;
}

/* —— Nav —— */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: var(--nav-h);
  padding: 12px 20px;
  background: rgba(5, 6, 8, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

/* Match site/index.html wordmark: emptori<span>.</span> */
.logo {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.25rem;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
  line-height: 1;
}

.logo span {
  color: var(--accent-2);
}

@media (max-width: 700px) {
  .logo {
    font-size: 1.12rem;
  }
}

.nav-links {
  display: none;
  align-items: center;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  min-height: 44px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover {
  color: var(--fg);
  background: var(--frame);
}

.nav-links a.active {
  color: var(--fg);
  background: rgba(76, 125, 255, 0.12);
}

.nav-meta {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

@media (min-width: 768px) {
  .nav-links {
    display: flex;
  }
  .app-nav {
    padding: 12px 28px;
  }
}

/* Mobile bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  min-height: var(--bottom-nav-h);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0));
  background: rgba(5, 6, 8, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 500;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.02em;
  border-radius: 10px;
  transition: color 0.2s, background 0.2s;
}

.bottom-nav a .icon {
  font-size: 1.15rem;
  line-height: 1;
}

.bottom-nav a.active {
  color: var(--fg);
  background: rgba(76, 125, 255, 0.1);
}

.bottom-nav a:hover {
  color: var(--fg);
}

@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
}

/* —— Layout —— */
.page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.page-app {
  padding-bottom: calc(var(--bottom-nav-h) + 28px + env(safe-area-inset-bottom, 0));
}

@media (min-width: 768px) {
  .page-app {
    padding-bottom: 40px;
    max-width: 880px;
  }
}

.page-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 4vw, 1.85rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 8px;
}

.page-sub {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.kicker {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
  font-family: "Space Grotesk", sans-serif;
}

/* —— Login —— */
.login-wrap {
  min-height: calc(100dvh - var(--nav-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 48px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(16, 19, 25, 0.95), rgba(10, 12, 16, 0.98));
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset,
    0 0 60px rgba(76, 125, 255, 0.06);
  padding: 36px 28px 32px;
}

.login-card h1 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(1.55rem, 4vw, 1.85rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 10px;
}

.login-card .lead {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 28px;
  line-height: 1.55;
}

.login-card .lead em {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  color: var(--fg);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.field label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}

.field input[type="email"] {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg);
  font: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input[type="email"]::placeholder {
  color: rgba(138, 147, 163, 0.7);
}

.field input[type="email"]:focus {
  border-color: rgba(76, 125, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(76, 125, 255, 0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s, background 0.2s,
    border-color 0.2s, opacity 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: 0 10px 30px rgba(76, 125, 255, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 12px 36px rgba(76, 125, 255, 0.35);
  filter: brightness(1.05);
}

.btn-secondary {
  background: var(--frame);
  color: var(--fg);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  border-color: rgba(76, 125, 255, 0.35);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.form-hint {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.45;
}

.form-msg {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.45;
  border: 1px solid var(--line);
  background: rgba(76, 125, 255, 0.08);
  color: var(--fg);
  display: none;
}

.form-msg.visible {
  display: block;
}

.form-msg.ok {
  background: rgba(0, 212, 170, 0.1);
  border-color: rgba(0, 212, 170, 0.25);
}

/* —— Empty states —— */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(16, 19, 25, 0.6), rgba(10, 12, 16, 0.4));
}

.empty-state h2 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.empty-state h2 .serif {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-weight: 400;
  color: var(--accent-2);
}

.empty-state p {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 360px;
  margin: 0 auto 24px;
  line-height: 1.55;
}

/* —— Lead list (homepage inbox-lead aesthetic) —— */
.lead-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* —— Utility —— */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--frame);
}

.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* Scrollbar (muted) */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

/* —— Vault cards = site .inbox-lead pattern —— */
.lead-card {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s var(--ease-out);
  overflow: hidden;
}

.lead-card:hover {
  border-color: rgba(76, 125, 255, 0.35);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}

/* Main row: score | name+reason | contact  (matches homepage mock) */
.lead-card-main {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.lead-card-main:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.score-pill {
  flex-shrink: 0;
  width: 44px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.78rem;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
  background: rgba(0, 212, 170, 0.12);
  color: #00d4aa;
  line-height: 1;
  white-space: nowrap;
}

.score-pill.hot {
  background: rgba(255, 180, 84, 0.15);
  color: var(--accent-2);
}

.score-pill.good {
  background: rgba(0, 212, 170, 0.12);
  color: #00d4aa;
}

.score-pill.large {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  font-size: 0.95rem;
}

.lead-card .info {
  flex: 1;
  min-width: 0;
}

.lead-card .name {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-header .page-title {
  font-weight: 700;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
}

.domain {
  font-size: 0.78rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.domain-link {
  color: var(--accent);
  text-decoration: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
}

.domain-link:hover {
  text-decoration: underline;
}

.lead-card .reason {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  line-height: 1.35;
}

/* Contact sits to the right on wider screens (homepage mock) */
.lead-card-main > .contact {
  flex-shrink: 0;
  max-width: 42%;
  font-size: 0.78rem;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--frame);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-signal {
  color: var(--accent);
  border-color: rgba(76, 125, 255, 0.25);
  background: rgba(76, 125, 255, 0.08);
}

.chip-muted {
  opacity: 0.85;
}

.person {
  font-size: 0.88rem;
  margin-bottom: 2px;
}

.person .title {
  color: var(--muted);
  font-weight: 400;
  margin-left: 6px;
}

.contact.mono,
.mono {
  font-size: 0.82rem;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

.contact.phone {
  color: var(--fg);
  opacity: 0.9;
}

/* Actions under the row — compact, not full-width tiles */
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 10px 66px; /* align under info (score width + gap) */
  border-top: none;
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  flex: 0 0 auto;
  width: auto;
}

.btn-copy:hover,
.btn-copy.linkish:hover {
  color: var(--fg);
  border-color: rgba(76, 125, 255, 0.35);
  background: rgba(255, 255, 255, 0.03);
}

.btn-copy.copied {
  color: var(--success);
  border-color: rgba(0, 212, 170, 0.35);
}

.btn-sm {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.85rem;
  width: auto;
}

.banner {
  margin-bottom: 20px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 180, 84, 0.25);
  background: rgba(255, 180, 84, 0.08);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

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

.badge-soft {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--accent-2);
  vertical-align: middle;
}

.list-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 0.9rem;
}

.list-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.list-footer a:hover {
  text-decoration: underline;
}

.list-footer.muted {
  color: var(--muted);
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.empty-actions .btn {
  width: auto;
  min-width: 140px;
}

/* Search */
.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 22px;
}

.search-bar input[type="search"] {
  flex: 1 1 180px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg);
  font: inherit;
  font-size: 0.95rem;
  outline: none;
}

.search-bar input[type="search"]:focus {
  border-color: rgba(76, 125, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(76, 125, 255, 0.15);
}

.check-phone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 44px;
  cursor: pointer;
  user-select: none;
}

.clear-link {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.clear-link:hover {
  color: var(--fg);
}

.history-item {
  margin-bottom: 4px;
}

.history-date {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 0 8px 2px;
  font-family: "Space Grotesk", sans-serif;
}

.history-item:first-child .history-date {
  margin-top: 0;
}

/* Detail */
.back-row {
  margin-bottom: 18px;
}

.back-row a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.back-row a:hover {
  color: var(--fg);
}

.detail-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.detail-section {
  margin-top: 28px;
}

.detail-section h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 10px;
}

.detail-body {
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--fg);
}

.detail-card {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.detail-card .contact {
  margin: 8px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.detail-actions {
  margin-top: 16px;
}

.detail-actions .btn {
  width: auto;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom-nav-h) + 16px);
  transform: translateX(-50%) translateY(12px);
  z-index: 200;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--fg);
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s var(--ease-out);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 768px) {
  .toast {
    bottom: 28px;
  }
}

/* Mobile: stack contact under name; actions full-bleed left */
@media (max-width: 640px) {
  .lead-card-main {
    flex-wrap: wrap;
    padding: 12px;
    gap: 10px;
  }
  .lead-card-main > .contact {
    max-width: 100%;
    width: 100%;
    text-align: left;
    padding-left: 54px; /* under info, past score */
    margin-top: -4px;
  }
  .lead-card .name {
    white-space: normal;
  }
  .lead-card .reason {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .card-actions {
    padding: 0 12px 10px 12px;
    border-top: 1px solid var(--line);
    padding-top: 8px;
  }
  .score-pill {
    width: 40px;
    height: 36px;
    font-size: 0.72rem;
  }
}

@media (max-width: 480px) {
  .search-bar .btn-sm {
    flex: 1;
  }
}

/* —— Reactions —— */
.react-row {
  display: inline-flex;
  gap: 4px;
  margin-right: 4px;
}

.btn-react {
  min-height: 32px;
  min-width: 36px;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  transition: border-color 0.15s, background 0.15s;
}

.btn-react:hover,
.btn-react.active {
  border-color: rgba(76, 125, 255, 0.4);
  background: rgba(76, 125, 255, 0.1);
}

/* —— Chat (Phase B) —— */
body.chat-page .page-app {
  max-width: 720px;
  padding-bottom: calc(var(--bottom-nav-h) + 8px);
}

.chat-layout {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--nav-h) - var(--bottom-nav-h) - 40px);
  gap: 12px;
}

.chat-header {
  flex-shrink: 0;
}

.chat-thread {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 12px;
  min-height: 200px;
  max-height: min(55dvh, 520px);
}

.bubble {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  font-size: 0.92rem;
  line-height: 1.5;
}

.bubble-meta {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  font-family: "Space Grotesk", sans-serif;
}

.bubble-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble-user {
  align-self: flex-end;
  background: rgba(76, 125, 255, 0.12);
  border-color: rgba(76, 125, 255, 0.22);
}

.bubble-agent {
  align-self: flex-start;
  background: var(--bg-3);
}

.bubble-system {
  align-self: center;
  max-width: 100%;
  background: var(--frame);
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.bubble.from-email .bubble-meta::after {
  content: "";
}

.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.chip-btn {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--frame);
  color: var(--muted);
  font-size: 0.78rem;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  cursor: pointer;
}

.chip-btn:hover {
  color: var(--fg);
  border-color: rgba(76, 125, 255, 0.35);
}

.chat-composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
  padding-top: 4px;
}

.chat-composer textarea {
  flex: 1;
  min-height: 48px;
  max-height: 140px;
  resize: vertical;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.45;
  outline: none;
}

.chat-composer textarea:focus {
  border-color: rgba(76, 125, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(76, 125, 255, 0.15);
}

.btn-send {
  width: auto;
  min-width: 88px;
  flex-shrink: 0;
}

.chat-error {
  color: var(--accent-2);
  font-size: 0.85rem;
  margin: 0;
}

@media (min-width: 768px) {
  body.chat-page .page-app {
    padding-bottom: 32px;
  }
  .chat-layout {
    min-height: calc(100dvh - var(--nav-h) - 80px);
  }
  .chat-thread {
    max-height: min(60dvh, 560px);
  }
}

/* —— Settings / ICP (Phase D) —— */
.settings-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  padding: 20px 18px;
  margin-bottom: 16px;
}

.settings-h {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}

.settings-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 14px;
  line-height: 1.5;
}

.settings-dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.settings-dl > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.settings-dl > div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.settings-dl dt {
  color: var(--muted);
  font-weight: 500;
}

.settings-dl dd {
  margin: 0;
  text-align: right;
  font-weight: 500;
}

.prefs-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 0.92rem;
  color: var(--fg);
  cursor: pointer;
}

.md-body {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 480px;
  overflow-y: auto;
}

.md-body h1,
.md-body h2,
.md-body h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  margin: 1em 0 0.4em;
}

.md-body p {
  margin: 0.4em 0;
}

.md-body ul {
  margin: 0.4em 0;
  padding-left: 1.2em;
}

/* Bottom nav: 5 items — slightly tighter */
@media (max-width: 767px) {
  .bottom-nav a {
    font-size: 0.62rem;
    padding: 4px 2px;
  }
}
