:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --ink: #141414;
  --muted: #6b6a66;
  --line: #e6e4df;
  --accent: #0e6b4e;
  /* One hue, stepping darker as the deal advances. */
  --s-pendiente: #d9d7d1;
  --s-ofrecido: #a8d5c3;
  --s-reunion: #4fa585;
  --s-vendido: #0e6b4e;
  --s-no: #c9a39b;
  --r: 14px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: #a3361f; font-size: 14px; min-height: 1.2em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none;
  font-weight: 600; font-size: 15px; cursor: pointer;
  transition: transform .15s var(--ease), background .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(360px, 100%); display: grid; gap: 14px; }
.login-card h1 { font-size: 34px; letter-spacing: -.02em; }
.login-card input { min-height: 48px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }

/* ---------- app ---------- */
.app { max-width: 760px; margin: 0 auto; padding: 28px 18px 80px; padding-top: max(28px, env(safe-area-inset-top)); }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 22px; }
.top h1 { font-size: 34px; letter-spacing: -.025em; margin: 2px 0 4px; }

.progress { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 18px; }
.bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--line); }
.seg { min-width: 6px; transition: flex .5s var(--ease); }
.stages { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 14px; }
.stage {
  display: grid; gap: 2px; justify-items: start; text-align: left;
  padding: 10px 10px 9px; border-radius: 10px; border: 1px solid transparent; background: none; cursor: pointer;
  position: relative; transition: background .2s, border-color .2s;
}
.stage::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-bottom: 4px; }
.stage .n { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stage .l { font-size: 12px; color: var(--muted); line-height: 1.2; }
.stage[aria-selected="true"] { background: var(--bg); border-color: var(--line); }

.s-pendiente { --c: var(--s-pendiente); }
.s-ofrecido { --c: var(--s-ofrecido); }
.s-reunion { --c: var(--s-reunion); }
.s-vendido { --c: var(--s-vendido); }
.s-no { --c: var(--s-no); }
.seg, .dot { background: var(--c); }

.filters { display: grid; gap: 12px; margin-bottom: 8px; }
.filters input[type="search"] { min-height: 46px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 14px; cursor: pointer; transition: background .2s, color .2s; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

.group { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 26px 4px 10px; }
.group span { color: var(--ink); margin-left: 4px; }
.card {
  width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: 14px 14px 14px 16px; margin-bottom: 8px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .2s;
}
@media (hover: hover) { .card:hover { box-shadow: 0 6px 20px -12px rgba(0,0,0,.25); } }
.card:active { transform: scale(.985); }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.body { display: grid; gap: 3px; min-width: 0; }
.name { font-weight: 600; font-size: 16px; line-height: 1.3; }
.meta, .who { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who { color: var(--ink); }
.pill { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; white-space: nowrap; background: color-mix(in srgb, var(--c) 30%, white); color: var(--ink); }
.pill.s-vendido { background: var(--s-vendido); color: #fff; }
.empty { text-align: center; padding: 40px 0; display: grid; gap: 12px; justify-items: center; color: var(--muted); }
.foot { font-size: 12px; text-align: center; margin-top: 32px; }

/* ---------- sheet ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20,20,20,.35); opacity: 0; transition: opacity .3s var(--ease); z-index: 10; }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11;
  max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--card); border-radius: 22px 22px 0 0;
  padding: 10px 20px calc(28px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .34s var(--ease);
  box-shadow: 0 -10px 40px -20px rgba(0,0,0,.3);
}
.sheet.open { transform: translateY(0); }
@media (min-width: 900px) {
  .sheet { left: auto; top: 0; width: 460px; max-height: none; border-radius: 0; transform: translateX(100%); padding-top: 28px; }
  .sheet.open { transform: translateX(0); }
  .grip { display: none; }
}
.grip { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 12px; }
.close { position: sticky; top: 0; float: right; border: 1px solid var(--line); background: var(--card); box-shadow: 0 4px 14px -8px rgba(0,0,0,.3); border-radius: 999px; padding: 8px 14px; font-size: 14px; cursor: pointer; z-index: 1; }
.title { font-size: 26px; letter-spacing: -.02em; line-height: 1.15; margin: 6px 0 4px; }
.sheet h3 { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 26px 0 10px; }
.sheet p { line-height: 1.5; }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; }
.facts > div { background: var(--bg); border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; }
.facts .k { font-size: 12px; color: var(--muted); }
.facts .v { font-weight: 600; font-size: 15px; }

.stepper { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); }
.stepper li { position: relative; }
.stepper li + li::before { content: ""; position: absolute; top: 15px; right: 50%; width: 100%; height: 3px; background: var(--line); }
.step { position: relative; z-index: 1; width: 100%; display: grid; justify-items: center; gap: 8px; border: 0; background: none; cursor: pointer; font-size: 13px; color: var(--muted); padding: 0 2px; text-align: center; }
.step .b { position: relative; width: 32px; height: 32px; border-radius: 50%; background: var(--card); border: 3px solid var(--line); transition: background .25s var(--ease), border-color .25s, transform .25s var(--ease); }
.step.done .b { background: var(--accent); border-color: var(--accent); }
.step.now .b { transform: scale(1.12); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent); }
.step.done, .step.now { color: var(--ink); font-weight: 600; }
.stepper li:has(.done) + li:has(.done)::before { background: var(--accent); }
.stepper.is-no .step.done .b { background: var(--s-no); border-color: var(--s-no); box-shadow: none; }
.link-btn { margin-top: 14px; border: 0; background: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 14px; padding: 6px 0; }
.link-btn.on { color: #8a4b3f; font-weight: 600; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 8px; }
.person { background: var(--bg); border-radius: 12px; padding: 14px; display: grid; gap: 4px; }
.pname { font-weight: 600; font-size: 17px; }
.warn { font-size: 13.5px; color: #7a5a12; background: #fbf1d6; border-radius: 8px; padding: 8px 10px; margin-top: 6px; }
.src { font-size: 13px; color: var(--accent); margin-top: 4px; word-break: break-all; }
.notes summary { cursor: pointer; font-size: 14px; font-weight: 600; margin-top: 18px; }
.notes p { margin-top: 8px; font-size: 14px; color: var(--muted); }
.draft { white-space: pre-wrap; font-family: inherit; font-size: 14px; line-height: 1.5; background: var(--bg); border-radius: 12px; padding: 14px; margin: 0 0 10px; }
textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); resize: vertical; line-height: 1.5; }
.hist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14px; }
.hist li { display: flex; justify-content: space-between; gap: 12px; }

.form { display: grid; gap: 12px; margin-top: 18px; }
.form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.form input { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 15px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  transition: transform .3s var(--ease), opacity .3s;
}
.toast.on { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 520px) {
  .stages { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; }
  .stage { padding: 8px 4px; }
  .stage .n { font-size: 20px; }
  .stage .l { font-size: 11px; }
  .pill { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
