/* ============================================================
   Waypoint CRM — chart-room identity
   paper #F2F5F1 · ink #15232B · chart magenta #BE2069
   Bricolage Grotesque (display) · Wix Madefor Text (UI)
   Spline Sans Mono (data voice)
   ============================================================ */

:root {
  --paper: #F2F5F1;
  --card: #FFFFFF;
  --well: #E9EFEA;
  --ink: #15232B;
  --ink-2: #33454F;
  --ink-soft: #5A6B74;
  --ink-faint: #8195A0;
  --line: #DAE3DD;
  --line-strong: #C3D0C8;
  --magenta: #BE2069;
  --magenta-deep: #97194F;
  --magenta-tint: #F9E7EF;
  --rail-ink: #14212A;
  --rail-ink-2: #1D2E39;
  --paper-on-ink: #EDF2EE;
  --faint-on-ink: #93A6B0;

  --green: #22713E;
  --green-tint: #E1EFE5;
  --blue: #2F6FB4;
  --blue-tint: #E3EDF7;
  --slate: #41628A;
  --slate-tint: #E5EBF3;
  --violet: #6C4BA6;
  --violet-tint: #ECE6F5;
  --ochre: #976619;
  --ochre-tint: #F5ECDA;
  --grey: #6E7B84;
  --grey-tint: #E8ECEE;

  --display: "Bricolage Grotesque", "Avenir Next", sans-serif;
  --body: "Wix Madefor Text", "Segoe UI", sans-serif;
  --mono: "Spline Sans Mono", "SFMono-Regular", monospace;

  --r-sm: 8px;
  --r-md: 11px;
  --r-lg: 15px;
  --shadow-card: 0 1px 2px rgba(21, 35, 43, 0.05), 0 3px 10px rgba(21, 35, 43, 0.04);
  --shadow-pop: 0 6px 16px rgba(21, 35, 43, 0.12), 0 20px 48px rgba(21, 35, 43, 0.18);
  --rail-w: 66px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--magenta); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- shared atoms ---------- */

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--paper-on-ink);
}
.wordmark-sm { font-size: 19px; gap: 8px; }
.wm-diamond {
  width: 15px; height: 15px; flex: none;
  background: var(--magenta);
  border-radius: 2.5px;
  transform: rotate(45deg);
}
.wordmark-sm .wm-diamond { width: 11px; height: 11px; border-radius: 2px; }
.wm-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--faint-on-ink);
  border: 1px solid rgba(147, 166, 176, 0.45);
  border-radius: 5px;
  padding: 2px 7px;
  margin-left: 2px;
  align-self: flex-start;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 600;
  font-size: 13.5px;
  border-radius: var(--r-sm);
  padding: 9px 16px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--magenta); color: #fff; }
.btn-primary:hover { background: var(--magenta-deep); }
.btn-ghost { border: 1px solid var(--line-strong); background: var(--card); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--ink-faint); }
.btn-danger { background: var(--magenta-tint); color: var(--magenta-deep); }
.btn-danger:hover { background: #F3D3E2; }
.btn-wide { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: default; pointer-events: none; }

.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 7px;
  color: var(--ink-faint);
  transition: color 0.15s, background 0.15s;
}
.iconbtn svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn:hover { color: var(--ink); background: var(--well); }
.iconbtn-ink { color: var(--faint-on-ink); }
.iconbtn-ink:hover { color: var(--paper-on-ink); background: var(--rail-ink-2); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.chip::before { content: ""; width: 5px; height: 5px; border-radius: 1px; transform: rotate(45deg); background: currentColor; }
.chip-lead     { background: var(--ochre-tint);  color: var(--ochre); }
.chip-active   { background: var(--blue-tint);   color: var(--blue); }
.chip-customer { background: var(--green-tint);  color: var(--green); }
.chip-archived { background: var(--grey-tint);   color: var(--grey); }
.chip-call     { background: var(--blue-tint);   color: var(--blue); }
.chip-email    { background: var(--violet-tint); color: var(--violet); }
.chip-meeting  { background: var(--green-tint);  color: var(--green); }
.chip-note     { background: var(--ochre-tint);  color: var(--ochre); }

.mono { font-family: var(--mono); }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px; height: 36px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--slate-tint);
  color: var(--slate);
}
.avatar-lead     { background: var(--ochre-tint); color: var(--ochre); }
.avatar-active   { background: var(--blue-tint);  color: var(--blue); }
.avatar-customer { background: var(--green-tint); color: var(--green); }
.avatar-archived { background: var(--grey-tint);  color: var(--grey); }

/* ---------- boot ---------- */

.boot {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--paper);
}
.boot-diamond {
  width: 20px; height: 20px;
  border-radius: 4px;
  background: var(--magenta);
  transform: rotate(45deg);
  animation: bootpulse 1.1s ease-in-out infinite;
}
@keyframes bootpulse {
  0%, 100% { opacity: 1; transform: rotate(45deg) scale(1); }
  50% { opacity: 0.45; transform: rotate(45deg) scale(0.82); }
}
.boot-word { font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.boot-note { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }

/* ---------- auth ---------- */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, 46%) 1fr;
}
.auth-chart {
  background:
    radial-gradient(1100px 500px at -10% 110%, rgba(190, 32, 105, 0.14), transparent 55%),
    var(--rail-ink);
  color: var(--paper-on-ink);
  display: flex;
  align-items: center;
  padding: 48px;
}
.auth-chart-inner { max-width: 440px; margin: 0 auto; width: 100%; }
.auth-route { width: 100%; max-width: 430px; margin: 42px 0 34px; }
.ar-line {
  stroke: rgba(147, 166, 176, 0.6);
  stroke-width: 1.6;
  stroke-dasharray: 1 7;
  stroke-linecap: round;
}
.ar-marks rect { fill: none; stroke: var(--faint-on-ink); stroke-width: 1.6; }
.ar-marks .ar-won { fill: var(--magenta); stroke: var(--magenta); }
.auth-head {
  font-family: var(--display);
  font-size: clamp(30px, 3.4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.06;
  margin-bottom: 14px;
}
.auth-copy { color: var(--faint-on-ink); font-size: 15px; max-width: 40ch; }

.demo-ticket {
  margin-top: 40px;
  border: 1.5px dashed rgba(147, 166, 176, 0.5);
  border-radius: var(--r-md);
  padding: 16px 18px;
  font-family: var(--mono);
}
.ticket-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--magenta);
  margin-bottom: 10px;
}
.ticket-label::after { content: " ◇"; color: var(--faint-on-ink); }
.ticket-line { font-size: 13px; display: flex; gap: 12px; padding: 2px 0; }
.ticket-line span {
  width: 74px; flex: none;
  color: var(--faint-on-ink);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 20px;
}
.ticket-btn {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--paper-on-ink);
  border-bottom: 1.5px solid var(--magenta);
  padding-bottom: 2px;
  transition: color 0.15s;
}
.ticket-btn:hover { color: #fff; }

.auth-deck { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 26px;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--well);
  border-radius: var(--r-sm);
  padding: 4px;
  margin-bottom: 22px;
}
.auth-tab {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 8px 4px;
  border-radius: 6px;
  text-align: center;
  transition: background 0.15s, color 0.15s;
}
.auth-tab.is-on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(21,35,43,0.08); }
.auth-form { display: grid; gap: 14px; }

/* ---------- fields ---------- */

.field { display: grid; gap: 5px; }
.field > span {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--card);
  padding: 9px 11px;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px var(--magenta-tint);
}
.field input::placeholder { color: var(--ink-faint); }
.field input[type="date"], .field input[type="datetime-local"], .field input[type="number"] { font-family: var(--mono); font-size: 13px; }
.form-error {
  font-size: 13px;
  color: var(--magenta-deep);
  background: var(--magenta-tint);
  border-radius: var(--r-sm);
  padding: 9px 12px;
}

/* ---------- app frame ---------- */

.app { min-height: 100vh; }

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail-w);
  background: var(--rail-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  z-index: 30;
}
.rail-brand { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 18px; }
.rail-brand .wm-diamond { width: 16px; height: 16px; }
.rail-nav { display: flex; flex-direction: column; gap: 6px; }
.rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 52px;
  padding: 9px 0 7px;
  border-radius: 10px;
  color: var(--faint-on-ink);
  transition: background 0.15s, color 0.15s;
}
.rail-item svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.rail-item span {
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.rail-item:hover { color: var(--paper-on-ink); background: var(--rail-ink-2); }
.rail-item.is-on { color: var(--paper-on-ink); background: var(--rail-ink-2); position: relative; }
.rail-item.is-on::before {
  content: "";
  position: absolute;
  left: -7px; top: 50%;
  width: 7px; height: 7px;
  border-radius: 1.5px;
  background: var(--magenta);
  transform: translateY(-50%) rotate(45deg);
}
.rail-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.user-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--rail-ink-2);
  color: var(--paper-on-ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.user-chip-sm { width: 30px; height: 30px; font-size: 11px; }

.main {
  margin-left: var(--rail-w);
  padding: 20px 26px 40px;
  max-width: 1560px;
}

.mobilebar { display: none; }
.tabbar { display: none; }

/* ---------- today strip ---------- */

.strip {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 14px 20px;
  margin-bottom: 22px;
}
.strip-cell { padding: 2px 22px; border-left: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.strip-cell:first-child { border-left: 0; padding-left: 0; }
.strip-k {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 3px;
}
.strip-v { font-family: var(--mono); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.strip-date .strip-v { font-family: var(--display); font-weight: 650; font-size: 20px; }
.strip-sub { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); margin-top: 2px; }
.strip-next {
  margin-left: auto;
  border-left: 1px solid var(--line);
  padding-left: 22px;
  max-width: 380px;
  min-width: 0;
}
.next-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  border-radius: var(--r-sm);
  min-width: 0;
  max-width: 100%;
}
.next-top { display: flex; align-items: center; gap: 8px; }
.next-when { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); }
.next-when.is-over { color: var(--magenta-deep); font-weight: 600; }
.next-sum {
  font-size: 13.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.next-btn:hover .next-sum { color: var(--magenta-deep); }
.next-empty { font-size: 13px; color: var(--ink-faint); }

/* ---------- view chrome ---------- */

.viewhead {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.viewhead h1 {
  font-family: var(--display);
  font-size: 27px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.viewhead .viewsub { font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); padding-bottom: 4px; }
.viewhead .spacer { flex: 1; }

/* ---------- board ---------- */

.board-scroll { overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.board-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(232px, 1fr));
  gap: 14px;
  min-width: 1050px;
}
.route-line {
  position: absolute;
  top: 13px;
  left: 6px;
  right: 6px;
  border-top: 2px dotted var(--line-strong);
  pointer-events: none;
}
.stage-col { min-width: 0; }
.stage-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 2px 10px;
}
.stage-mark {
  width: 11px; height: 11px; flex: none;
  border-radius: 2px;
  transform: rotate(45deg);
  border: 2px solid var(--ink-2);
  background: var(--paper);
}
.stage-won .stage-mark { background: var(--green); border-color: var(--green); }
.stage-lost .stage-mark { border-color: var(--ink-faint); background: var(--paper); opacity: 0.75; }
.stage-name {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  background: var(--paper);
  padding-right: 5px;
}
.stage-head .stage-mark { box-shadow: 0 0 0 4px var(--paper); }
.stage-lost .stage-name, .stage-lost .stage-sum { color: var(--ink-faint); }
.stage-count {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--well);
  border-radius: 999px;
  padding: 1px 7px;
}
.stage-sum { margin-left: auto; font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--ink-2); background: var(--paper); padding-left: 5px; }
.stage-body {
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: max(240px, calc(100vh - 350px));
  transition: border-color 0.15s, background 0.15s;
}
.stage-body.is-over { border-color: var(--magenta); background: var(--magenta-tint); }
.stage-empty {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 26px 8px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-align: center;
}
.stage-empty::before {
  content: "";
  width: 13px; height: 13px;
  border: 1.6px dashed var(--ink-faint);
  border-radius: 2.5px;
  transform: rotate(45deg);
}

.deal-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  padding: 11px 12px 9px;
  cursor: grab;
  transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.deal-card:hover { border-color: var(--line-strong); box-shadow: 0 2px 6px rgba(21,35,43,0.09), 0 6px 18px rgba(21,35,43,0.07); }
.deal-card.is-drag { opacity: 0.45; cursor: grabbing; }
.deal-top { display: flex; align-items: baseline; gap: 10px; }
.deal-title {
  font-size: 13.8px;
  font-weight: 600;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  text-align: left;
  border-radius: 4px;
}
.deal-title:hover { color: var(--magenta-deep); }
.deal-value { font-family: var(--mono); font-size: 13px; font-weight: 600; white-space: nowrap; }
.deal-meta { margin-top: 4px; font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-meta b { font-weight: 600; color: var(--ink-2); }
.deal-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.deal-date {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
}
.deal-date.is-over { color: var(--magenta-deep); border-color: #EBC2D4; background: var(--magenta-tint); }
.deal-foot .spacer { flex: 1; }
.nudge {
  width: 24px; height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: var(--card);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.nudge svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.nudge:hover { color: var(--magenta-deep); border-color: var(--magenta); background: var(--magenta-tint); }
.nudge[disabled] { opacity: 0.35; pointer-events: none; }

/* ---------- toolbar (contacts) ---------- */

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.searchbox {
  position: relative;
  flex: 0 1 300px;
  min-width: 210px;
}
.searchbox svg {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  stroke: var(--ink-faint); stroke-width: 1.8; fill: none; stroke-linecap: round;
}
.searchbox input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--card);
  padding: 8px 11px 8px 33px;
  font-size: 13.5px;
}
.searchbox input:focus { outline: none; border-color: var(--magenta); box-shadow: 0 0 0 3px var(--magenta-tint); }
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-pill {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  background: var(--card);
  border-radius: 999px;
  padding: 5px 12px;
  transition: all 0.15s;
}
.filter-pill:hover { border-color: var(--ink-faint); }
.filter-pill.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper-on-ink); }

/* ---------- list panels ---------- */

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.rowlist { display: flex; flex-direction: column; }
.row {
  display: grid;
  grid-template-columns: 44px minmax(180px, 1.4fr) 110px minmax(150px, 1fr) 130px 30px;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  transition: background 0.12s;
}
.row:first-child { border-top: 0; }
.row:hover { background: var(--paper); }
.row-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-mono { font-family: var(--mono); font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-chev { color: var(--ink-faint); }
.row-chev svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.acct-row {
  grid-template-columns: 44px minmax(180px, 1.3fr) minmax(120px, 1fr) 110px 110px 34px;
}
.acct-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--well);
  color: var(--ink-2);
}
.acct-mark svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.empty-block {
  padding: 54px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.empty-block::before {
  content: "";
  width: 15px; height: 15px;
  border: 1.7px dashed var(--ink-faint);
  border-radius: 3px;
  transform: rotate(45deg);
  margin-bottom: 4px;
}
.empty-title { font-family: var(--display); font-size: 17px; font-weight: 600; }
.empty-note { font-size: 13px; color: var(--ink-soft); max-width: 42ch; }

/* ---------- contact detail ---------- */

.backlink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 14px;
  border-radius: 4px;
}
.backlink svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.backlink:hover { color: var(--magenta-deep); }

.person-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.person-head .avatar { width: 52px; height: 52px; font-size: 16px; border-radius: 14px; }
.person-id h1 { font-family: var(--display); font-size: 25px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
.person-id p { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.person-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 18px;
  align-items: start;
}
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.card-h {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px 0;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.card-h .count { color: var(--ink-faint); font-weight: 500; }

.fact-list { padding: 12px 18px 16px; display: grid; gap: 10px; }
.fact { display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: baseline; }
.fact dt {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.fact dd { font-size: 13.5px; word-break: break-word; }
.fact dd.mono { font-size: 12.5px; }
.fact dd a { color: var(--ink-2); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.fact dd a:hover { color: var(--magenta-deep); }

.mini-deal {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  width: 100%;
  text-align: left;
  transition: background 0.12s;
}
.mini-deal:hover { background: var(--paper); }
.mini-deal .t { flex: 1; min-width: 0; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-deal .v { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.mini-stage {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 5px;
  padding: 2px 7px;
}
.ms-new       { background: var(--slate-tint);  color: var(--slate); }
.ms-qualified { background: var(--blue-tint);   color: var(--blue); }
.ms-proposal  { background: var(--violet-tint); color: var(--violet); }
.ms-won       { background: var(--green-tint);  color: var(--green); }
.ms-lost      { background: var(--grey-tint);   color: var(--grey); }

/* timeline */

.composer { display: grid; grid-template-columns: 112px minmax(150px, 1fr) 205px auto; gap: 10px; padding: 14px 18px 6px; }
.composer .field select, .composer .field input { padding: 8px 10px; font-size: 13px; }
.composer .field input[type="datetime-local"] { font-size: 12px; padding: 9px 6px 9px 9px; }
.timeline { padding: 10px 18px 16px; display: flex; flex-direction: column; }
.tl-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0 12px 2px;
  border-top: 1px solid var(--line);
}
.tl-item:first-child { border-top: 0; }
.tl-glyph {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.tl-glyph svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tl-call    { background: var(--blue-tint);   color: var(--blue); }
.tl-email   { background: var(--violet-tint); color: var(--violet); }
.tl-meeting { background: var(--green-tint);  color: var(--green); }
.tl-note    { background: var(--ochre-tint);  color: var(--ochre); }
.tl-body { flex: 1; min-width: 0; }
.tl-sum { font-size: 13.8px; font-weight: 500; line-height: 1.35; overflow-wrap: break-word; }
.tl-when { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); margin-top: 3px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tl-over {
  color: var(--magenta-deep);
  font-weight: 600;
  background: var(--magenta-tint);
  border-radius: 5px;
  padding: 1px 6px;
}
.tl-item.is-done .tl-sum { color: var(--ink-faint); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.tl-item.is-done .tl-glyph { opacity: 0.5; }
.tl-side { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.donebox {
  width: 22px; height: 22px;
  border-radius: 7px;
  border: 1.6px solid var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  background: var(--card);
  transition: all 0.15s;
}
.donebox svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.donebox:hover { border-color: var(--green); color: var(--green-tint); }
.donebox.is-on { background: var(--green); border-color: var(--green); color: #fff; }

/* ---------- modal ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 25, 32, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadein 0.14s ease;
}
@keyframes fadein { from { opacity: 0; } }
.modal {
  width: min(480px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  animation: modalin 0.16s ease;
}
@keyframes modalin { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
.modal-h {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 0;
}
.modal-h h2 { font-family: var(--display); font-size: 19px; font-weight: 650; letter-spacing: -0.015em; flex: 1; }
.modal-b { padding: 16px 20px 4px; display: grid; gap: 13px; }
.modal-b .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.modal-f {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 16px 20px 20px;
}
.modal-f .left { margin-right: auto; }
.modal-note { font-size: 13px; color: var(--ink-soft); }

/* ---------- toasts ---------- */

.toastroot {
  position: fixed;
  z-index: 50;
  left: calc(var(--rail-w) + 18px);
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: min(400px, calc(100vw - 100px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--rail-ink);
  color: var(--paper-on-ink);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: var(--shadow-pop);
  animation: toastin 0.18s ease;
}
@keyframes toastin { from { opacity: 0; transform: translateY(6px); } }
.toast::before {
  content: "";
  flex: none;
  width: 7px; height: 7px;
  border-radius: 1.5px;
  transform: rotate(45deg);
  background: var(--green);
}
.toast-error::before { background: var(--magenta); }

/* ---------- responsive ---------- */

@media (max-width: 1120px) {
  .strip { flex-wrap: wrap; gap: 12px 0; }
  .strip-next { margin-left: 0; max-width: 100%; flex: 1 1 100%; border-left: 0; border-top: 1px solid var(--line); padding: 10px 0 0; }
}

@media (max-width: 920px) {
  :root { --rail-w: 0px; }
  .rail { display: none; }
  .main { margin-left: 0; padding: 0 14px calc(84px + env(safe-area-inset-bottom)); }
  .mobilebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--rail-ink);
    margin: 0 -14px 16px;
    padding: 11px 16px;
  }
  .mobilebar-side { display: flex; align-items: center; gap: 8px; }
  .tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: var(--rail-ink);
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  }
  .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 0 5px;
    border-radius: 10px;
    color: var(--faint-on-ink);
  }
  .tab-item svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
  .tab-item span { font-family: var(--mono); font-size: 9px; font-weight: 500; letter-spacing: 0.13em; text-transform: uppercase; }
  .tab-item.is-on { color: #fff; }
  .tab-item.is-on span { color: var(--magenta); }
  .toastroot { left: 14px; right: 14px; bottom: calc(74px + env(safe-area-inset-bottom)); max-width: none; }

  .auth { grid-template-columns: 1fr; }
  .auth-chart { padding: 28px 22px; }
  .auth-route { margin: 22px 0 18px; }
  .auth-head { font-size: 27px; }
  .auth-deck { padding: 26px 16px 44px; }

  .strip { padding: 12px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 0; }
  .strip-cell { border-left: 0; padding: 0 12px 0 0; }
  .strip-cell:nth-child(2n) { border-left: 1px solid var(--line); padding-left: 14px; }
  .strip-v { font-size: 16.5px; }
  .strip-date .strip-v { font-size: 17px; }
  .strip-next { grid-column: 1 / -1; border-top: 1px solid var(--line); padding: 10px 0 0; }

  .board-track { grid-template-columns: repeat(5, 78vw); min-width: 0; }
  .board-scroll { scroll-snap-type: x proximity; margin: 0 -14px; padding: 0 14px 8px; }
  .stage-col { scroll-snap-align: start; }

  .row { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 11px; padding: 12px 14px; }
  .row .row-hide, .row .row-chev { display: none; }
  .row .chip { font-size: 9.5px; padding: 3px 7px; }
  .acct-row { grid-template-columns: 44px minmax(0, 1fr) auto 34px; }
  .acct-row .row-mono { max-width: 92px; }

  .detail-grid { grid-template-columns: 1fr; }
  .person-actions { margin-left: 0; width: 100%; }
  .composer { grid-template-columns: 1fr 1fr; }
  .composer .c-sum { grid-column: 1 / -1; }
  .composer .c-btn { grid-column: 1 / -1; }
  .modal-b .grid2 { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .viewhead h1 { font-size: 23px; }
  .board-track { grid-template-columns: repeat(5, 86vw); }
}
