/* Proceeds Pilot Lite — mobile-first, system fonts only, no third-party assets. */
:root {
  --navy: #0f2a4a;
  --navy-2: #16375f;
  --navy-deep: #0a1c32;
  --sky: #38bdf8;
  --sky-soft: #e0f2fe;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --ink: #0f172a;
  --muted: #5b6b80;
  --line: #d9e2ec;
  --bg: #f3f6fa;
  --card: #ffffff;
  --ok: #0f7a4a;
  --ok-soft: #dcfce7;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --warn: #9a6700;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 42, 74, 0.06), 0 8px 24px -12px rgba(15, 42, 74, 0.18);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --topbar-h: 56px;
  --tabbar-h: 64px;
  --focus: 0 0 0 3px rgba(56, 189, 248, 0.55);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--navy-2); }

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  background: #fff;
  color: var(--navy);
  padding: 8px 12px;
  border-radius: 8px;
}
.skip:focus { left: 8px; }

#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topbar-h);
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: var(--navy);
  color: #fff;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.brand img, .brand svg { width: 32px; height: 32px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-weight: 800; letter-spacing: -0.02em; font-size: 1.02rem; }
.brand-text strong em { font-style: normal; color: var(--sky); }
.brand-text span { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: #b9d8ee; }
.topbar-actions { margin-left: auto; display: flex; gap: 6px; }
.icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  display: grid;
  place-items: center;
}
.icon-btn:hover, .icon-btn:focus-visible { background: rgba(255,255,255,0.1); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.icon-btn svg { width: 22px; height: 22px; }

.banner {
  margin: 0;
  padding: 10px 16px;
  font-size: 0.88rem;
}
.banner.sample { background: var(--sky-soft); color: var(--navy-deep); border-bottom: 1px solid #bae6fd; }
.banner.offline { background: var(--amber-soft); color: #633806; border-bottom: 1px solid #fde68a; }
.banner.install { background: #fff; border-bottom: 1px solid var(--line); }
.banner ol { margin: 8px 0 0; padding-left: 1.2em; }
.banner-row { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.banner .hint-note { color: var(--muted); font-size: 0.8rem; margin: 8px 0 0; }

main {
  flex: 1;
  padding: 16px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 36px);
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 4px 4px max(6px, env(safe-area-inset-bottom));
  padding-left: max(4px, env(safe-area-inset-left));
  padding-right: max(4px, env(safe-area-inset-right));
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 12px;
  position: relative;
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a[aria-current="page"], .tabbar a:focus-visible { color: var(--navy); background: var(--sky-soft); }
.tabbar a:focus-visible { outline: none; box-shadow: var(--focus); }
.tabbar .badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.62rem;
  line-height: 16px;
  text-align: center;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: 1.45rem; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; }
.lede { color: var(--muted); margin: 0 0 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin: 0 0 12px;
}
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:focus-visible { outline: none; box-shadow: var(--focus); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 16px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
}
.stat .v { display: block; font-size: 1.35rem; font-weight: 800; color: var(--navy); letter-spacing: -0.03em; }
.stat .l { display: block; font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 650; }
.stat.warn .v { color: var(--warn); }
.stat.danger .v { color: var(--danger); }

.row-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: start;
}
.row-card h3 { font-size: 1rem; margin: 0 0 2px; }
.meta { color: var(--muted); font-size: 0.82rem; }
.amount { font-weight: 700; color: var(--navy); white-space: nowrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #e8eef5;
  color: var(--navy);
  letter-spacing: 0.01em;
}
.chip.sample { background: var(--sky-soft); color: #075985; }
.chip.overdue, .dl-overdue { background: var(--danger-soft); color: var(--danger); }
.chip.soon, .dl-soon { background: var(--amber-soft); color: var(--warn); }
.chip.ok, .dl-later { background: var(--ok-soft); color: var(--ok); }
.chip.none, .dl-none { background: #eef2f6; color: var(--muted); }
.chip.high { background: var(--danger-soft); color: var(--danger); }

.status-New { background: #e8eef5; color: var(--navy); }
.status-Contacted { background: #e0f2fe; color: #075985; }
.status-Follow-up { background: #fef3c7; color: #92400e; }
.status-Call-booked { background: #ede9fe; color: #5b21b6; }
.status-Agreement-sent { background: #fae8ff; color: #86198f; }
.status-Agreement-signed { background: #d1fae5; color: #065f46; }
.status-Claim-filed { background: #dbeafe; color: #1e40af; }
.status-Paid { background: #dcfce7; color: #166534; }
.status-Lost { background: #f1f5f9; color: #475569; }

.search-row { display: flex; gap: 8px; margin: 0 0 12px; }
.search-row input[type="search"],
input[type="text"], input[type="date"], input[type="time"],
input[type="email"], input[type="tel"], input[type="number"],
select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px 12px;
  min-height: 44px;
  color: var(--ink);
}
textarea { min-height: 88px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-color: var(--sky);
}

.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin: 0 0 8px; -webkit-overflow-scrolling: touch; }
.filters button, .seg button {
  flex: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 40px;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--navy);
}
.filters button[aria-pressed="true"], .seg button[aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 0;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn.secondary { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--navy); }
.btn.danger { background: var(--danger); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.dl-flag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
}

.pipeline {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 2px 16px;
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
  -webkit-overflow-scrolling: touch;
}
.pipe-col {
  flex: 0 0 min(78vw, 280px);
  scroll-snap-align: start;
  background: #eef3f8;
  border-radius: var(--radius);
  padding: 10px;
  min-height: 40vh;
}
.pipe-col h2 { font-size: 0.85rem; display: flex; justify-content: space-between; align-items: baseline; }
.pipe-col .count { color: var(--muted); font-weight: 700; }
.pipe-card {
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 8px;
  border: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  display: block;
}
.pipe-card:focus-visible { outline: none; box-shadow: var(--focus); }

.detail-grid { display: grid; gap: 10px; }
.field label, .kv .k {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.kv { margin: 0 0 10px; }
.kv .v { font-size: 0.98rem; }
.section-title { margin: 20px 0 8px; font-size: 0.95rem; }

.fu-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.fu-item .type { font-weight: 700; text-transform: capitalize; }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  transform: translateX(-50%) translateY(20px);
  background: var(--navy-deep);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  z-index: 80;
  max-width: min(90vw, 420px);
  text-align: center;
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.privacy {
  font-size: 0.9rem;
  background: var(--sky-soft);
  border: 1px solid #bae6fd;
  border-radius: var(--radius);
  padding: 14px 16px;
}
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

.addon {
  opacity: 0.92;
}
.addon .price { font-weight: 700; color: var(--navy); }

.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--navy);
  text-decoration: none;
  font-weight: 650;
  min-height: 44px;
  margin: -8px 0 4px;
}
.back:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }

@media (min-width: 720px) {
  .pipeline { margin: 0; padding-left: 0; padding-right: 0; }
  .pipe-col { flex-basis: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-color-scheme: dark) {
  /* Keep a consistent branded surface; dark scheme can come later.
     Contrast is already designed on the light app shell. */
}

.cluster { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.stack-10 .field + .field { margin-top: 10px; }
.offline-page { padding: 32px 20px; max-width: 420px; margin: 0 auto; text-align: center; }
.offline-page img { margin: 24px auto; width: 64px; height: 64px; }
.field-caption {
  display: block;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.title-chips { margin: 0 0 12px; }

main:focus { outline: none; }
.meta, .v, .pipe-card { overflow-wrap: break-word; }
.filters, .pipeline { scrollbar-width: none; }
.filters::-webkit-scrollbar, .pipeline::-webkit-scrollbar { display: none; }
.banner.install.compact { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.banner.install.compact p { margin: 0; }
.banner.install.compact .btn-row { margin: 0; flex-shrink: 0; }
