:root {
  --bg: #12100d; --surface: #1c1812; --text: #eee4d3; --accent: #6fe3c0;
  --border: #322c22; --radius: 10px; --font: ui-monospace, "SF Mono", Consolas, monospace;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f4ecd8; --surface: #fffaf0; --text: #2b241a; --border: #ddd0b0; }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); }
img { max-width: 100%; }
[hidden] { display: none !important; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 1.2rem 4rem; }
.top-nav {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; gap: 1rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 1.05rem; }
.brand canvas { image-rendering: pixelated; width: 26px; height: 26px; }
.cta { background: var(--accent); color: #0b0f0c; padding: 0.5rem 1rem; border-radius: 999px; text-decoration: none; font-size: 0.85rem; font-weight: 600; }

.hero { text-align: center; padding: 3rem 0 2rem; }
.hero-sprite canvas { image-rendering: pixelated; width: 96px; height: 96px; }
.hero h1 { font-size: 2rem; line-height: 1.3; margin: 1rem 0; }
.hero h1 span { color: var(--accent); }
.hero p { font-size: 1rem; opacity: 0.85; max-width: 620px; margin: 0 auto 1.6rem; }
.hero-ctas { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }
.btn-hero { padding: 0.7rem 1.3rem; border-radius: 999px; text-decoration: none; font-weight: 600; border: 1px solid var(--border); }
.btn-hero.primary { background: var(--accent); color: #0b0f0c; border-color: var(--accent); }
.btn-hero.secondary { color: var(--text); }

h2.section-title { text-align: center; font-size: 1.3rem; margin: 3rem 0 0.5rem; }
p.section-sub { text-align: center; opacity: 0.7; max-width: 560px; margin: 0 auto 1.6rem; font-size: 0.9rem; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; }
.feature-card h3 { margin: 0 0 0.4rem; font-size: 0.95rem; color: var(--accent); }
.feature-card p { margin: 0; font-size: 0.82rem; opacity: 0.85; line-height: 1.5; }

.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.price-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem; }
.price-card.featured { border-color: var(--accent); }
.price-card .plan-name { font-weight: 600; }
.price-card .plan-price { font-size: 1.5rem; font-weight: 700; margin: 0.3rem 0; }
.price-card ul { margin: 0.5rem 0 0; padding-left: 1.1rem; font-size: 0.8rem; opacity: 0.85; line-height: 1.6; }

footer { text-align: center; font-size: 0.75rem; opacity: 0.55; margin-top: 3rem; }

/* --- Auth form -------------------------------------------------------- */
.auth-box { max-width: 360px; margin: 2rem auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.auth-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.auth-tab { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 0.45rem; opacity: 0.7; cursor: pointer; font-family: inherit; color: var(--text); }
.auth-tab.active { opacity: 1; border-color: var(--accent); color: var(--accent); }
.auth-form { display: flex; flex-direction: column; gap: 0.6rem; }
.auth-form input { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.8rem; color: var(--text); font-size: 16px; font-family: inherit; }
.auth-form button[type=submit] { background: var(--accent); color: var(--bg); border: none; border-radius: 8px; padding: 0.65rem; font-weight: 600; cursor: pointer; }
.auth-error { color: #e88; font-size: 0.8rem; min-height: 1.1em; margin: 0; }

/* --- App shell ---------------------------------------------------------- */
#app-shell { max-width: 1100px; margin: 0 auto; padding: 0 1rem 3rem; }
.app-header { display: flex; align-items: center; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.app-tabs { display: flex; gap: 0.4rem; flex: 1; flex-wrap: wrap; }
.app-tab { background: none; border: 1px solid transparent; color: var(--text); opacity: 0.65; cursor: pointer; font-family: inherit; font-size: 0.88rem; padding: 0.45rem 0.85rem; border-radius: 999px; }
.app-tab.active { opacity: 1; background: var(--surface); border-color: var(--border); color: var(--accent); }
.plan-badge { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0.2rem 0.6rem; opacity: 0.8; }
.btn { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 0.5rem 0.9rem; font-family: inherit; font-size: 0.85rem; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: #0b0f0c; border-color: var(--accent); font-weight: 600; }
.btn-danger { color: #e88; }

.panel { padding: 1.5rem 0; }
.field-group { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.7rem; }
.field-group label { font-size: 0.75rem; opacity: 0.7; display: flex; flex-direction: column; gap: 0.3rem; }
.field-group input, .field-group textarea, .field-group select {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.55rem 0.7rem; color: var(--text); font-family: inherit; font-size: 0.9rem;
}
.field-group label input, .field-group label textarea, .field-group label select { font-size: 0.9rem; opacity: 1; }
.form-row { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.form-row .field-group { flex: 1; min-width: 160px; }

.card-list { display: flex; flex-direction: column; gap: 0.6rem; }
.item-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1rem; display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.item-card .item-main { flex: 1; min-width: 180px; }
.item-card strong { display: block; }
.item-card .item-sub { font-size: 0.8rem; opacity: 0.65; }
.item-actions { display: flex; gap: 0.4rem; }

.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.8rem; align-items: start; }
.pipeline-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.7rem; min-height: 60px; }
.pipeline-col h4 { margin: 0 0 0.5rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.7; }
.deal-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.7rem; margin-bottom: 0.5rem; font-size: 0.85rem; }
.deal-card .deal-value { color: var(--accent); font-weight: 600; font-size: 0.8rem; }
.deal-card select { width: 100%; margin-top: 0.4rem; font-size: 0.72rem; }

.empty-msg { opacity: 0.6; font-size: 0.85rem; padding: 1rem 0; }
.task-row { display: flex; align-items: center; gap: 0.6rem; }
.task-row.done .task-title { text-decoration: line-through; opacity: 0.5; }
.task-title { flex: 1; }
.task-meta { font-size: 0.75rem; opacity: 0.6; }

#toast-region { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 0.4rem; z-index: 50; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 1rem; font-size: 0.85rem; box-shadow: 0 4px 16px rgba(0,0,0,0.3); }

/* ===== Mongoose CRM v2: Today / People / Deals / Insights / Data ===== */
:root { --late: #ff8a6b; --ok: #6fe3c0; --muted: #a89f8b; --card: #211c15; }
@media (prefers-color-scheme: light) { :root { --late: #c4471f; --ok: #1f8f6a; --muted: #6b604c; --card: #fffdf6; } }
.muted { color: var(--muted); font-size: 0.86rem; }
.block { display: block; }
.nav-badge { display: inline-block; min-width: 1.35rem; padding: 0 0.4rem; margin-left: 0.25rem; border-radius: 999px; background: var(--late); color: #1a0f0a; font-size: 0.72rem; font-weight: 700; text-align: center; line-height: 1.35rem; }
.app-tabs { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; }
.app-tabs::-webkit-scrollbar { display: none; }
.app-tab { white-space: nowrap; }
.view { max-width: 1040px; margin: 0 auto; }
.view-title { font-size: 1.5rem; margin: 0.4rem 0 0.2rem; }
.view-sub { color: var(--muted); margin: 0 0 1rem; }
.empty-state { text-align: center; padding: 2.2rem 1rem; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); }
.empty-title { font-weight: 600; color: var(--text); }
.empty-hint { margin-top: 0.3rem; font-size: 0.9rem; }
.link-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.person-name { font-weight: 700; font-size: 1.02rem; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.person-name:hover { text-decoration-color: var(--accent); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--text); border-color: var(--border); }
.chips { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }
.chip { font: inherit; font-size: 0.74rem; padding: 0.05rem 0.55rem; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--muted); }
button.chip { cursor: pointer; }
button.chip:hover, .chip-on { border-color: var(--accent); color: var(--accent); }
.due-badge { flex: none; align-self: flex-start; font-size: 0.74rem; padding: 0.1rem 0.6rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.due-badge.late { border-color: var(--late); color: var(--late); font-weight: 700; }
.row-main { flex: 1; min-width: 0; }

/* Today */
[data-mood="alert"] .app-header .brand canvas { filter: drop-shadow(0 0 4px var(--late)); }
[data-mood="pleased"] .app-header .brand canvas { filter: drop-shadow(0 0 4px var(--ok)); }
.chase-card { display: block; }
.chase-card.overdue { border-left: 3px solid var(--late); }
.chase-head { display: flex; gap: 0.8rem; justify-content: space-between; align-items: flex-start; }
.chase-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }
.quick-log { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.quick-log input[type="text"] { flex: 1 1 14rem; }
.quick-log textarea { flex: 1 1 100%; font: inherit; resize: vertical; min-height: 2.4em; }
.deal-card .deal-notes { white-space: pre-wrap; }
.task-row.overdue .task-meta { color: var(--late); }
.stale-deal { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }

/* People */
.people-layout { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 1.2rem; align-items: start; }
.people-list { position: sticky; top: 4.2rem; max-height: calc(100vh - 5rem); overflow-y: auto; }
.list-tools { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.list-tools input[type="search"] { flex: 1 1 10rem; }
.filter-chips { margin: 0 0 0.6rem; }
.person-row { display: flex; width: 100%; gap: 0.6rem; justify-content: space-between; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.person-row.selected { border-color: var(--accent); }
.more-row { margin: 0.6rem 0; text-align: center; }
.back-btn { display: none; padding-left: 0; }
.profile-head { margin-bottom: 0.8rem; }
.rhythm { margin-top: 0.3rem; }
.log-box, .rhythm-bar, .details { margin-bottom: 1rem; }
.log-title { font-weight: 700; margin-bottom: 0.4rem; }
.log-box textarea, .details textarea { width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 0.5rem; }
.seg-btn { background: transparent; border: 0; padding: 0.3rem 0.9rem; color: var(--muted); font: inherit; cursor: pointer; }
.seg-btn.on { background: var(--accent); color: #0b0f0c; font-weight: 700; }
.rhythm-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-end; }
.trail { display: flex; flex-direction: column; gap: 0.4rem; }
.trail-entry { display: grid; grid-template-columns: 6.2rem 1fr auto; gap: 0.6rem; padding: 0.55rem 0.7rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.trail-kind { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.trail-entry.kind-call .trail-kind, .trail-entry.kind-meeting .trail-kind, .trail-entry.kind-email .trail-kind { color: var(--ok); }
.trail-entry.kind-stage .trail-kind { color: var(--accent); }
.trail-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.trail-when { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
.new-person, .new-deal { margin-bottom: 0.8rem; }

/* Deals */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.7rem; margin: 0.6rem 0 1rem; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem 1rem; }
.stat-label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 1.5rem; font-weight: 700; }
.board { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 0.7rem; overflow-x: auto; padding-bottom: 0.6rem; }
.board-col { background: rgba(127, 127, 127, 0.06); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.6rem; min-height: 8rem; }
.col-head { display: flex; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.col-title { font-weight: 700; }
.board-col.stage-won { border-top: 3px solid var(--ok); }
.board-col.stage-lost { border-top: 3px solid var(--late); }
.deal-card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem; margin-bottom: 0.5rem; }
.deal-title { font-weight: 600; overflow-wrap: anywhere; }
.deal-value { color: var(--accent); font-weight: 700; }
.deal-actions { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.5rem; }
.deal-actions select { max-width: 9rem; }

/* Insights */
.chart { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0.5rem; align-items: end; height: 11rem; padding: 0.8rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.chart-col { display: flex; flex-direction: column; height: 100%; }
.bar-stack { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; }
.bar { width: 100%; min-height: 0; }
.bar-touch { background: var(--ok); border-radius: 3px 3px 0 0; }
.bar-notes { background: var(--muted); opacity: 0.55; }
.chart-label { text-align: center; font-size: 0.7rem; color: var(--muted); margin-top: 0.3rem; }
.legend { margin-top: 0.5rem; color: var(--muted); font-size: 0.82rem; }
.swatch { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 3px; vertical-align: middle; }
.swatch.touch { background: var(--ok); } .swatch.notes { background: var(--muted); opacity: 0.55; }
.stage-row { display: flex; gap: 1rem; align-items: center; }
.stage-row .muted { flex: 1; }
.stage-val { font-weight: 700; }
.stage-row.total { border-color: var(--accent); }

/* Data */
.import-result { margin-top: 0.6rem; }
.problems { margin: 0.4rem 0 0; padding-left: 1.2rem; color: var(--muted); font-size: 0.86rem; }

@media (max-width: 760px) {
  .people-layout { grid-template-columns: 1fr; }
  .people-list { position: static; max-height: none; }
  .people-layout.has-detail .people-list { display: none; }
  .people-layout:not(.has-detail) .people-detail { display: none; }
  .back-btn { display: inline-block; }
  .trail-entry { grid-template-columns: 1fr; gap: 0.15rem; }
  .board { grid-template-columns: repeat(5, 78vw); }
  .chase-head { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* v2 overrides: the landing page's centered, tall section headings must not leak into the app screens */
.view h2.section-title, .view h3.section-title { text-align: left; margin: 1.4rem 0 0.5rem; font-size: 1.1rem; }
.app-tabs { flex-wrap: nowrap; }

/* ---- polish found by looking at real screenshots ---- */
/* every plain control in the app looks like the styled ones (the landing-page rules only styled inputs inside .field-group) */
.view input[type="text"], .view input[type="search"], .view input[type="email"], .view input[type="number"], .view input[type="date"],
.view input[type="password"], .view select, .view textarea {
  font: inherit; font-size: 0.9rem; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.5rem 0.65rem; min-width: 0;
}
.view input:focus-visible, .view select:focus-visible, .view textarea:focus-visible, .view button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.view .form-row { align-items: flex-end; }
.view .form-row > .btn { flex: none; }
.rhythm-bar { flex-direction: row; }
.rhythm-bar .field-group { margin-bottom: 0; }
.deal-actions select { width: auto; }

@media (max-width: 760px) {
  /* the header wraps: brand + plan + sign out on top, the section tabs on their own scrolling row (they were being clipped) */
  .app-header { gap: 0.5rem 0.8rem; }
  .app-tabs { order: 3; flex: 1 0 100%; overflow-x: auto; padding-bottom: 0.3rem; }
  .view-title { font-size: 1.3rem; }
  .list-tools input[type="search"] { flex: 1 1 100%; }
}

/* Scout (Pro): reads a person's Trail and writes for you */
.scout-card { border-left: 3px solid var(--accent, #d4a24c); padding-left: 0.9rem; }
.scout-card .form-row { align-items: flex-end; }
.scout-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.scout-out { display: flex; flex-direction: column; gap: 0.6rem; }
.scout-out:empty { display: none; }
.scout-out textarea { width: 100%; box-sizing: border-box; }
.scout-text { line-height: 1.5; }
.scout-loops { margin: 0; padding-left: 1.2rem; }
.scout-warn { padding: 0.5rem 0.7rem; border-radius: 6px; border: 1px solid rgba(255, 190, 90, 0.5); background: rgba(255, 190, 90, 0.12); }

/* Mongoose ID (docs/MONGOOSE_ONE.md): "Continue with Mongoose" above the sign-in form. */
.mongoose-signin { display: grid; gap: 8px; margin-bottom: 12px; }
.btn.mongoose-id { display: flex; align-items: center; justify-content: center; gap: 10px; background: #12100d; color: #eee4d3; border: 1px solid #3a3226; text-decoration: none; padding: 10px 14px; border-radius: 10px; }
.btn.mongoose-id::before { content: ""; width: 18px; height: 18px; border-radius: 5px; background: #6fe3c0 url("/sprite/icon-192.png") center / cover no-repeat; }
.btn.mongoose-id:hover { border-color: #6fe3c0; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 2px 0; font-size: 12px; opacity: .7; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .3; }
/* The legal pages' own layout (it used to be an inline <style>, which the CSP doesn't allow). */
.wrap.legal { max-width: 760px; }
.legal h2 { font-size: 1.05rem; margin-top: 2rem; }
.legal p, .legal li { font-size: 0.9rem; line-height: 1.7; opacity: 0.9; }
.legal .legal-fine { margin-top: 2rem; opacity: 0.6; font-size: 0.78rem; }
