/* ============================================================
   USA Wholesale Deal AI — design system
   Dark emerald green + black theme, white / light-grey content.
   Mobile-first, responsive. System fonts only (fast, no webfont
   dependency). All pages share this file; do not fork it.
   ============================================================ */

:root {
  --emerald-900: #022c22;
  --emerald-800: #064e3b;
  --emerald-700: #047857;
  --emerald-600: #059669;
  --emerald-500: #10b981;
  --emerald-100: #d1fae5;
  --emerald-50: #ecfdf5;
  --black: #0a0f0d;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f6f5;
  --card: #ffffff;
  --amber: #b45309;
  --red: #b91c1c;
  --blue: #1d4ed8;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 14px rgba(0, 0, 0, .05);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
}
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5rem; color: var(--black); }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1rem; }
a { color: var(--emerald-700); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.small { font-size: .875rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------- public header / footer ---------- */
.site-header {
  background: var(--black);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 60px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-800));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #fff; flex: none;
}
.brand small { display: block; font-size: .68rem; font-weight: 600; color: var(--emerald-500); letter-spacing: .04em; }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.main-nav a {
  color: #d1d5db; padding: 8px 10px; border-radius: 8px; font-size: .92rem; font-weight: 600;
}
.main-nav a:hover { color: #fff; background: #1f2937; text-decoration: none; }
.main-nav a.active { color: #fff; background: var(--emerald-700); }
.site-footer { background: var(--black); color: #9ca3af; margin-top: 56px; padding: 40px 0 28px; font-size: .9rem; }
.site-footer a { color: #d1d5db; }
.site-footer h4 { color: #fff; margin-bottom: 10px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 24px; }

/* ---------- hero / sections (public) ---------- */
.hero {
  background: linear-gradient(160deg, var(--emerald-900) 0%, var(--black) 55%, #052e22 100%);
  color: #fff;
  padding: 64px 0 72px;
}
.hero h1 { color: #fff; font-size: 2.4rem; max-width: 640px; }
.hero p.lede { color: #d1fae5; font-size: 1.15rem; max-width: 620px; }
.hero .tagline { color: var(--emerald-500); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; font-size: .85rem; }
.section { padding: 48px 0; }
.section.alt { background: #fff; }
.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---------- cards / stats ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card h3 { margin-bottom: .35rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .num { font-size: 1.7rem; font-weight: 800; color: var(--emerald-800); line-height: 1.1; }
.stat .lbl { font-size: .82rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.property-card { overflow: hidden; padding: 0; }
.property-card .body { padding: 16px; }
.property-card .thumb {
  height: 150px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--emerald-800), var(--emerald-500));
  color: #fff; font-size: 2.4rem;
}
.badge {
  display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 9px;
  border-radius: 999px; background: var(--emerald-100); color: var(--emerald-800);
}
.badge.grey { background: #e5e7eb; color: #374151; }
.badge.amber { background: #fef3c7; color: var(--amber); }
.badge.red { background: #fee2e2; color: var(--red); }
.badge.blue { background: #dbeafe; color: var(--blue); }
.demo-badge {
  display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .05em;
  background: #fef3c7; color: var(--amber); border: 1px dashed var(--amber);
  padding: 3px 8px; border-radius: 6px; text-transform: uppercase;
}

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px;
  font: inherit; font-size: .95rem; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--emerald-500); outline-offset: 1px; border-color: var(--emerald-600); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }
.form-note { font-size: .85rem; color: var(--muted); }
.btn {
  display: inline-block; border: 0; cursor: pointer; font: inherit; font-weight: 700;
  padding: 11px 20px; border-radius: 9px; background: var(--emerald-600); color: #fff;
}
.btn:hover { background: var(--emerald-700); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--emerald-800); border: 1px solid var(--emerald-700); }
.btn.dark { background: var(--black); }
.btn.ghost { background: transparent; color: var(--emerald-800); border: 1px solid var(--line); }
.btn.small { padding: 7px 12px; font-size: .88rem; }
.btn.danger { background: var(--red); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f9fafb; }
tr:hover td { background: #f9fafb; }
td .num, .num { font-variant-numeric: tabular-nums; }

/* ---------- app layout (sidebar) ---------- */
.app-layout { display: flex; min-height: 100vh; }
.app-sidebar {
  width: 250px; flex: none; background: var(--black); color: #d1d5db;
  padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.app-sidebar .brand { margin-bottom: 18px; }
.app-nav { display: flex; flex-direction: column; gap: 2px; }
.app-nav a {
  color: #d1d5db; padding: 9px 12px; border-radius: 8px; font-size: .92rem; font-weight: 600;
  display: flex; gap: 10px; align-items: center;
}
.app-nav a:hover { background: #1f2937; color: #fff; text-decoration: none; }
.app-nav a.active { background: var(--emerald-700); color: #fff; }
.app-nav .nav-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #6b7280; padding: 14px 12px 4px; font-weight: 800; }
.app-main { flex: 1; min-width: 0; padding: 24px 28px 48px; }
.app-topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px;
}
.app-topbar h1 { font-size: 1.6rem; margin: 0; }
.app-topbar .spacer { flex: 1; }
.page-intro { color: var(--muted); max-width: 720px; }

/* ---------- kanban ---------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kanban-col {
  flex: 0 0 250px; background: #eef2f0; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; min-height: 200px;
}
.kanban-col h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--emerald-800); }
.kanban-col.drag-over { outline: 2px dashed var(--emerald-500); outline-offset: -2px; }
.deal-card {
  background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 12px;
  margin-bottom: 10px; cursor: grab; box-shadow: var(--shadow); font-size: .9rem;
}
.deal-card:active { cursor: grabbing; }
.deal-card .amt { font-weight: 800; color: var(--emerald-800); }

/* ---------- charts (CSS bars, no library) ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding: 10px 4px 0; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-chart .bar {
  width: 100%; max-width: 44px; background: linear-gradient(180deg, var(--emerald-500), var(--emerald-700));
  border-radius: 6px 6px 0 0; min-height: 3px;
}
.bar-chart .bar-lbl { font-size: .72rem; color: var(--muted); text-align: center; }
.bar-chart .bar-val { font-size: .75rem; font-weight: 700; }

/* ---------- chat / assistant ---------- */
.chat-box { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.chat-log { height: 380px; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 82%; padding: 11px 14px; border-radius: 12px; font-size: .94rem; }
.msg.user { align-self: flex-end; background: var(--emerald-700); color: #fff; }
.msg.ai { align-self: flex-start; background: #f3f4f6; border: 1px solid var(--line); }
.prompt-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 14px; }
.chip {
  border: 1px solid var(--emerald-600); color: var(--emerald-800); background: var(--emerald-50);
  border-radius: 999px; padding: 6px 12px; font-size: .85rem; cursor: pointer; font-weight: 600;
}
.chat-input { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; }

/* ---------- misc ---------- */
.callout {
  border-left: 4px solid var(--emerald-600); background: var(--emerald-50);
  padding: 14px 16px; border-radius: 0 10px 10px 0; margin: 16px 0;
}
.callout.warn { border-color: var(--amber); background: #fffbeb; }
.callout.danger { border-color: var(--red); background: #fef2f2; }
.callout p { margin: 0 0 .4rem; }
.callout p:last-child { margin-bottom: 0; }
.result-box { background: var(--emerald-900); color: #fff; border-radius: var(--radius); padding: 20px; }
.result-box .big { font-size: 1.9rem; font-weight: 800; color: #6ee7b7; }
.result-box .lbl { color: #a7f3d0; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-top: 14px; }
.result-grid .cell { background: rgba(255, 255, 255, .07); border-radius: 9px; padding: 12px; }
.result-grid .cell .v { font-size: 1.25rem; font-weight: 800; }
.result-grid .cell .k { font-size: .78rem; color: #a7f3d0; }
.formula { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #f3f4f6; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: .88rem; overflow-x: auto; }
.faq details { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 14px 16px; margin-bottom: 10px; }
.faq summary { font-weight: 700; cursor: pointer; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--black); color: #fff; padding: 11px 18px; border-radius: 9px;
  font-size: .92rem; z-index: 100; box-shadow: var(--shadow); display: none;
}
.hidden { display: none !important; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .app-sidebar { width: 210px; }
  .app-main { padding: 18px 16px 40px; }
}
@media (max-width: 720px) {
  h1 { font-size: 1.6rem; }
  .hero { padding: 40px 0 48px; }
  .hero h1 { font-size: 1.9rem; }
  .app-layout { flex-direction: column; }
  .app-sidebar { width: 100%; height: auto; position: static; padding: 12px; }
  .app-nav { flex-direction: row; flex-wrap: wrap; }
  .app-nav a { padding: 7px 10px; font-size: .85rem; }
  .app-nav .nav-section { width: 100%; padding: 8px 10px 2px; }
  .main-nav { margin-left: 0; }
}
@media print {
  .site-header, .site-footer, .app-sidebar, .btn { display: none !important; }
  body { background: #fff; }
}
