:root {
  --blue: #2e5dff;
  --blue-soft: #eaeffe;
  --blue-tint: #f4f6fe;
  --paper: #fafafa;
  --paper-2: #f5f4f0;
  --paper-3: #efeee9;
  --ink-0: #0a0a0a;
  --ink-1: #2a2c30;
  --ink-2: #5e6068;
  --ink-3: #8b8d94;
  --ink-4: #b8bac0;
  --rule: rgba(10, 10, 10, 0.09);
  --rule-soft: rgba(10, 10, 10, 0.05);
  --good: #1a8f59;
  --good-soft: #e7f3ec;
  --warn: #a06d10;
  --warn-soft: #f6eed7;
  --bad: #b53a3a;
  --bad-soft: #f5e3e1;
  --muted-soft: #ececea;
  --muted: #737370;
  --surface: #fffefa;
  --serif: "DM Serif Display", "Cormorant Garamond", Georgia, serif;
  --sans: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --sidebar-w: 240px;
  --shadow-side: -28px 0 60px -28px rgba(10,10,10,0.18), 0 0 0 1px rgba(10,10,10,0.06);
}

* { box-sizing: border-box; }
html, body, #linea-crm-v2-root { height: 100%; margin: 0; }
body {
  background: var(--paper);
  color: var(--ink-1);
  font: 13.5px/1.5 var(--sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; }
button { border: 0; background: none; color: inherit; cursor: pointer; }

.login-shell {
  min-height: 100vh;
  overflow: auto;
  background: var(--paper);
}
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
}
.login-brand {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 30px 40px;
  border-right: 1px solid var(--rule);
  background: var(--paper-2);
}
.login-brand-mark {
  width: max-content;
}
.login-brand h1 {
  margin: 10px 0 6px;
  font-family: var(--serif);
  font-size: 56px;
  line-height: .98;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink-0);
}
.login-brand p {
  max-width: 360px;
  margin: 0;
  color: var(--ink-2);
  font-size: 15px;
}
.login-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-3);
  font-size: 12px;
}
.login-panel {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 40px;
  background: var(--surface);
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.login-field span {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.login-field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-0);
  outline: 0;
  padding: 9px 11px;
}
.login-field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(46,93,255,.1);
}
.login-submit {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  background: var(--ink-0);
  color: var(--surface);
  font-weight: 500;
  transition: background .16s ease, transform .12s ease;
}
.login-submit:hover {
  background: var(--blue);
}
.login-submit:active {
  transform: translateY(1px);
}
.login-alert {
  border: 1px solid rgba(181,58,58,.2);
  border-radius: 6px;
  background: var(--bad-soft);
  color: #8a2a2a;
  padding: 10px 12px;
  font-size: 12.5px;
}
.login-alert--warn {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-color: rgba(160,109,16,.24);
  background: var(--warn-soft);
  color: #72500d;
}
.login-alert code {
  font: 11.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.v2-boot {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--ink-3);
}
.v2-boot-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }

.app {
  height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 100vh;
  overflow: hidden;
}
.app[data-sidebar="rail"] { --sidebar-w: 60px; }
.sidebar {
  height: 100vh;
  background: var(--paper-2);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px 22px 24px;
}
.app[data-sidebar="rail"] .sidebar { align-items: center; padding-inline: 10px; }
.brand { display: flex; align-items: center; gap: 9px; padding: 0 2px; min-height: 32px; }
.brand-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); flex: 0 0 auto; }
.client-mark { font-family: var(--serif); font-size: 20px; line-height: 1; color: var(--ink-0); }
.brand-sub { margin-left: auto; color: var(--ink-3); font-size: 11px; }
.sidebar-collapse { margin-left: auto; width: 24px; height: 24px; border-radius: 5px; color: var(--ink-3); }
.sidebar-collapse:hover { background: rgba(10,10,10,.06); color: var(--ink-0); }
.app[data-sidebar="rail"] .brand-dot,
.app[data-sidebar="rail"] .client-mark,
.app[data-sidebar="rail"] .brand-sub,
.app[data-sidebar="rail"] .nav-label,
.app[data-sidebar="rail"] .nav-count,
.app[data-sidebar="rail"] .nav-section,
.app[data-sidebar="rail"] .sidebar-footer { display: none; }
.app[data-sidebar="rail"] .sidebar-collapse { margin-left: 0; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-form { margin: 0; }
.nav-section {
  padding: 0 8px 6px;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 6px;
  text-align: left;
  color: var(--ink-1);
}
.nav-item svg { color: var(--ink-3); }
.nav-item:hover { background: rgba(10,10,10,.04); }
.nav-item.is-active { background: var(--ink-0); color: #fafafa; }
.nav-item.is-active svg, .nav-item.is-active .nav-count { color: rgba(250,250,250,.62); }
.nav-label { flex: 1; }
.nav-count { color: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.nav-spacer { flex: 1; }
.sidebar-footer { border-top: 1px solid var(--rule); padding-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.prepared-mark,
.delivered-mark { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-1); font-size: 12px; font-weight: 500; white-space: nowrap; }
.prepared-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--blue); display: inline-block; flex: 0 0 auto; }
.sidebar-user { display: flex; align-items: center; gap: 9px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--ink-0); color: #fafafa; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.user-name { font-weight: 500; line-height: 1.2; }
.user-role { color: var(--ink-3); font-size: 10.5px; }

.main { min-width: 0; min-height: 0; height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 56px;
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  background: var(--paper);
}
.topbar-title { display: flex; gap: 9px; align-items: center; min-width: 210px; color: var(--ink-2); }
.topbar-client { color: var(--ink-0); font-family: var(--serif); font-size: 17px; line-height: 1; }
.topbar-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-4); }
.topbar-title strong { color: var(--ink-1); font-weight: 500; }
.search { flex: 1; max-width: 460px; position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--paper-2);
  padding: 7px 64px 7px 32px;
  outline: 0;
}
.search input:focus { background: var(--surface); border-color: var(--rule); }
.kbd {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--ink-3);
  font-size: 10.5px;
}
.search .kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); background: var(--surface); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-date { color: var(--ink-3); font-size: 12px; padding-right: 4px; white-space: nowrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 11px;
  border-radius: 6px;
  border: 1px solid var(--rule);
  background: var(--surface);
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: rgba(10,10,10,.04); color: var(--ink-1); border-color: transparent; }
.btn--primary { background: var(--ink-0); border-color: var(--ink-0); color: #fafafa; }
.btn--primary:hover { background: var(--blue); border-color: var(--blue); }
a.btn { text-decoration: none; }
.icon-btn { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--ink-2); }
.icon-btn:hover { background: rgba(10,10,10,.05); color: var(--ink-0); }

.board-shell { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.board-head { padding: 20px 24px 14px; border-bottom: 1px solid var(--rule-soft); display: flex; flex-direction: column; gap: 14px; }
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.kicker { text-transform: uppercase; letter-spacing: .12em; font-size: 10.5px; font-weight: 500; color: var(--blue); }
.board-title { margin: 0; font-family: var(--serif); font-size: 30px; line-height: 1.1; letter-spacing: -0.015em; color: var(--ink-0); font-weight: 400; }
.board-sub { color: var(--ink-2); font-size: 12.5px; }
.activity-view { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 24px 32px; scrollbar-width: thin; }
.activity-view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.activity-filter-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip-count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(10,10,10,.05);
  color: var(--ink-3);
  font-size: 10.5px;
  text-align: center;
}
.chip.is-active .chip-count { background: rgba(46,93,255,.12); color: var(--blue); }
.activity-feed { display: flex; flex-direction: column; gap: 8px; max-width: 980px; }
.activity-feed-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(10,10,10,.03);
}
.activity-feed-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink-2);
}
.activity-feed-icon[data-type="Email"] { color: var(--blue); background: var(--blue-tint); }
.activity-feed-icon[data-type="Meeting"] { color: var(--warn); background: var(--warn-soft); }
.activity-feed-icon[data-type="Proposal"] { color: var(--good); background: var(--good-soft); }
.activity-feed-icon[data-type="Note"] { color: var(--ink-2); background: var(--muted-soft); }
.activity-feed-body { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.activity-feed-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.activity-feed-lead { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font-weight: 600; color: var(--ink-0); }
.activity-feed-lead:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.activity-feed-date { flex: 0 0 auto; color: var(--ink-3); font-size: 11.5px; }
.activity-feed-meta { display: flex; flex-wrap: wrap; gap: 5px; color: var(--ink-3); font-size: 11.5px; }
.activity-feed-summary,
.activity-feed-outcome {
  margin: 0;
  color: var(--ink-1);
  font-size: 13px;
  line-height: 1.45;
}
.activity-feed-outcome {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--rule);
  color: var(--ink-2);
}
.activity-feed-outcome span {
  margin-right: 7px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 10px;
  font-weight: 600;
}
.activity-empty {
  max-width: 980px;
  border: 1px dashed var(--rule);
  border-radius: 8px;
  padding: 22px;
  color: var(--ink-3);
  background: var(--paper-2);
}
.activity-empty--error { color: var(--bad); background: var(--bad-soft); border-color: rgba(181,58,58,.2); }
.seg { display: inline-flex; gap: 0; padding: 3px; border: 1px solid var(--rule); background: var(--paper-2); border-radius: 7px; }
.seg button { padding: 5px 10px; border-radius: 5px; color: var(--ink-2); font-size: 12px; }
.seg button.is-active { background: var(--surface); color: var(--ink-0); box-shadow: 0 1px 2px rgba(10,10,10,.06); }

.kpi-strip { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--surface); }
.kpi { padding: 12px 16px; border-right: 1px solid var(--rule); text-align: left; animation: fadeUp .28s cubic-bezier(.2,.7,.2,1) both; }
.kpi:last-child { border-right: 0; }
.kpi:hover, .kpi.is-active { background: var(--blue-tint); }
.kpi-label { color: var(--ink-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 500; }
.kpi-num { font-family: var(--serif); font-size: 28px; line-height: 1.1; color: var(--ink-0); font-weight: 400; }
.kpi-num span { font-family: var(--sans); font-size: 14px; color: var(--ink-3); margin-left: 5px; }
.kpi-sub { color: var(--ink-2); font-size: 12.5px; }
.kpi--bad .kpi-num { color: var(--bad); }
.kpi--blue .kpi-num { color: var(--blue); }
.kpi--warn .kpi-num { color: var(--warn); }

.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px dashed var(--rule);
  color: var(--ink-2);
  font-size: 11.5px;
}
.chip:hover { color: var(--ink-0); border-color: var(--ink-3); }
.chip.is-active { border-style: solid; border-color: rgba(46,93,255,.25); background: var(--blue-tint); color: var(--blue); }
.spacer { flex: 1; }
.summary { color: var(--ink-3); font-size: 11.5px; display: flex; gap: 8px; align-items: center; }
.summary button { text-decoration: underline; color: var(--ink-2); }

.board { flex: 1; min-height: 0; overflow-x: auto; overflow-y: auto; padding: 14px 24px 24px; scrollbar-width: thin; }
.board.is-wrapped { overflow-x: hidden; }
.board-section { margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: center; gap: 10px; padding: 0 2px; }
.section-head h2 { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); font-weight: 500; }
.section-head .count { font-size: 11px; color: var(--ink-3); background: rgba(10,10,10,.04); padding: 1px 7px; border-radius: 999px; }
.section-head .rule { flex: 1; height: 1px; background: var(--rule); }
.cols { display: flex; gap: 12px; align-items: flex-start; min-height: 200px; }
.board.is-wrapped .cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.col {
  flex: 0 0 244px;
  max-height: calc(100vh - 320px);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.col.is-drop { border-color: var(--blue); box-shadow: 0 0 0 1.5px var(--blue); transform: translateY(-1px); }
.col-head {
  padding: 10px 12px 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid var(--rule-soft);
}
.col-head .swatch { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 auto; }
.col-head h3 { margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--sans); font-size: 12.5px; font-weight: 500; color: var(--ink-1); }
.col-head .count { color: var(--ink-3); background: rgba(10,10,10,.05); padding: 1px 7px; border-radius: 999px; font-size: 11px; font-variant-numeric: tabular-nums; }
.col-head .add { width: 22px; height: 22px; border-radius: 5px; color: var(--ink-3); display: inline-flex; align-items: center; justify-content: center; }
.col-head .add:hover { background: rgba(10,10,10,.06); color: var(--ink-0); }
.col-body { flex: 1; min-height: 80px; overflow-y: auto; scrollbar-width: thin; display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.col.is-drop .col-body { background: rgba(46,93,255,.06); }
.empty { color: var(--ink-4); border: 1px dashed var(--rule); border-radius: 6px; padding: 16px 8px; text-align: center; font-size: 11.5px; }

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left-width: 1px;
  border-radius: 6px;
  padding: 10px 11px 9px;
  cursor: pointer;
  user-select: none;
  transition: border-color .12s, box-shadow .12s, transform .12s;
  animation: invIn .42s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(var(--i, 0) * 32ms);
}
.card:hover { border-color: var(--ink-3); box-shadow: 0 2px 6px rgba(10,10,10,.06); }
.card.is-selected { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue); }
.card.is-dragging { opacity: .45; border-style: dashed; background: var(--blue-tint); transform: scale(.985); }
.card[data-status-style="border"] { border-left-width: 3px; }
.card[data-status-style="border"][data-status="Follow-Up"] { border-left-color: var(--warn); }
.card[data-status-style="border"][data-status="Next Steps"] { border-left-color: var(--blue); }
.card[data-status-style="border"][data-status="Delayed"] { border-left-color: var(--ink-3); }
.card[data-status-style="border"][data-status="Done"] { border-left-color: var(--ink-3); }
.card-top { display: block; min-width: 0; }
.card-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.card-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-0); font-size: 13px; font-weight: 500; }
.card-offering { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-size: 11.5px; }
.prio { font-size: 9.5px; font-weight: 500; letter-spacing: .04em; padding: 1px 5px; border-radius: 3px; }
.prio--P1 { background: var(--ink-0); color: #fafafa; }
.prio--P2 { background: var(--blue); color: #fff; }
.prio--P3 { background: transparent; color: var(--ink-2); }
.card-secondary { color: var(--ink-2); font-size: 11.5px; margin-top: 3px; display: flex; gap: 6px; min-width: 0; }
.card-secondary span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-secondary .src { color: var(--ink-3); }
.meta { margin-top: 7px; display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 11px; }
.next { display: inline-flex; align-items: center; gap: 4px; }
.card-next { justify-content: flex-end; margin-left: auto; text-align: right; white-space: nowrap; min-width: max-content; }
.card-next-row { display: flex; justify-content: flex-end; margin-top: 8px; color: var(--ink-3); font-size: 11px; }
.card-chip-row { align-items: center; flex-wrap: nowrap; justify-content: space-between; gap: 8px; }
.card-chip-stack { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.next.overdue { color: var(--bad); font-weight: 500; }
.next.today { color: var(--blue); font-weight: 500; }
.next.soon { color: var(--warn); }
.status-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 4px; font-size: 10.5px; border: 1px solid transparent; }
.status-chip::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: .72; }
.status-chip[data-status="Follow-Up"] { background: var(--warn-soft); border-color: rgba(160,109,16,.2); color: #7a5210; }
.status-chip[data-status="Next Steps"] { background: var(--blue-soft); border-color: rgba(46,93,255,.18); color: var(--blue); }
.status-chip[data-status="Delayed"] { background: var(--muted-soft); border-color: rgba(10,10,10,.08); color: var(--ink-2); }
.status-chip[data-status="Done"] { background: var(--muted-soft); border-color: rgba(10,10,10,.08); color: var(--ink-2); }
.extra { display: flex; gap: 8px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--rule); color: var(--ink-3); font-size: 10.5px; }
.board[data-density="compact"] .card-secondary, .board[data-density="compact"] .extra { display: none; }
.board[data-density="compact"] .card { padding: 7px 10px; }

.backdrop, .modal-back, .cmd-back { position: fixed; inset: 0; background: rgba(10,10,10,.2); z-index: 70; animation: fadeIn .18s ease-out; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(820px, calc(100vw - 48px));
  max-width: calc(100vw - 48px);
  background: var(--surface);
  z-index: 80;
  box-shadow: -28px 0 60px -28px rgba(10,10,10,.18), 0 0 0 1px rgba(10,10,10,.06);
  display: flex;
  flex-direction: column;
  animation: slideIn .28s cubic-bezier(.2,.7,.2,1);
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes invIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.drawer-head { background: var(--surface); border-bottom: 1px solid var(--rule); padding: 22px 30px 24px; display: flex; flex-direction: column; gap: 18px; }
.drawer-top { display: flex; align-items: flex-start; gap: 14px; }
.drawer-close { margin-top: 7px; }
.drawer-title { margin: 0; flex: 1; min-width: 0; font-family: var(--serif); font-size: clamp(32px, 3vw, 44px); color: var(--ink-0); line-height: .96; font-weight: 400; letter-spacing: 0; }
.drawer-title input { width: 100%; border: 0; outline: 0; background: transparent; font: inherit; border-bottom: 1px dashed var(--blue); }
.drawer-title-edit {
  display: inline-flex;
  max-width: 100%;
  align-items: flex-start;
  gap: 8px;
  color: inherit;
  text-align: left;
  font: inherit;
  line-height: inherit;
}
.drawer-title-edit span:first-child { min-width: 0; overflow-wrap: anywhere; }
.drawer-title-edit-mark {
  display: inline-flex;
  flex: 0 0 auto;
  margin-top: .18em;
  color: var(--ink-4);
  opacity: 0;
  transition: opacity .16s ease, color .16s ease;
}
.drawer-title-edit:hover .drawer-title-edit-mark,
.drawer-title-edit:focus-visible .drawer-title-edit-mark {
  color: var(--blue);
  opacity: 1;
}
.drawer-open-page,
.drawer-contact-line a,
.drawer-section-link {
  text-decoration: none;
}
.drawer-open-page {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 16px;
  white-space: nowrap;
}
.drawer-open-page:hover { color: var(--ink-0); }
.drawer-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.drawer-contact-line {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  color: var(--ink-2);
  font-size: 15px;
}
.drawer-contact-line span,
.drawer-contact-line a {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  color: inherit;
}
.drawer-contact-line a { overflow-wrap: anywhere; }
.drawer-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}
.drawer-actions .icon-btn {
  border: 0;
  background: transparent;
  color: var(--ink-2);
}
.drawer-advance {
  min-width: 128px;
  min-height: 42px;
  justify-content: center;
  border-color: var(--rule);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-1);
  font-size: 16px;
}
.drawer-stage-rail {
  display: flex;
  align-items: flex-start;
  padding: 16px 28px 0;
}
.drawer-stage-step {
  position: relative;
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--ink-3);
  text-align: center;
}
.drawer-stage-step::before {
  content: "";
  position: absolute;
  top: 13px;
  right: 50%;
  left: -50%;
  z-index: 0;
  height: 2px;
  background: var(--rule);
}
.drawer-stage-step:first-child::before { display: none; }
.drawer-stage-step.is-done::before,
.drawer-stage-step.is-current::before {
  background: var(--ink-0);
}
.drawer-stage-node {
  position: relative;
  z-index: 1;
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-3);
  font-weight: 500;
}
.drawer-stage-step.is-done .drawer-stage-node {
  border-color: var(--ink-0);
  background: var(--ink-0);
  color: #fff;
}
.drawer-stage-step.is-current .drawer-stage-node {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 0 0 7px rgba(46,93,255,.18);
}
.drawer-stage-step.is-done,
.drawer-stage-step.is-current {
  color: var(--ink-0);
}
.drawer-stage-step.is-current {
  color: var(--blue);
}
.drawer-stage-label {
  position: relative;
  z-index: 1;
  max-width: 92px;
  padding: 0 3px;
  background: var(--surface);
  font-size: 15px;
  line-height: 1.12;
}
.drawer-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 44px; padding: 24px 30px 28px; border-bottom: 1px solid var(--rule); background: var(--surface); }
.drawer-meta .k { font-size: 13px; letter-spacing: .13em; margin-bottom: 9px; }
.drawer-meta .v { color: var(--ink-1); font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
.k { color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; font-size: 10.5px; font-weight: 500; margin-bottom: 3px; }
.v { color: var(--ink-1); }
.drawer select, .drawer input, .modal input, .modal select, .modal textarea {
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  padding: 7px 10px;
  outline: 0;
  width: 100%;
}
.drawer select:focus, .drawer input:focus, .modal input:focus, .modal select:focus, .modal textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(46,93,255,.12);
}
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 30px 56px; }
.drawer-section { margin-top: 28px; }
.drawer-section:first-child { margin-top: 0; }
.section-title { display: flex; align-items: center; gap: 14px; color: var(--ink-3); font-size: 13px; text-transform: uppercase; letter-spacing: .14em; font-weight: 500; margin-bottom: 14px; }
.section-title .rule { flex: 1; height: 1px; background: var(--rule-soft); }
.section-title a { color: var(--ink-2); font-size: 15px; letter-spacing: 0; text-transform: none; text-decoration: none; white-space: nowrap; }
.touch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.touch-card { border: 1px solid var(--rule); background: var(--surface); border-radius: 7px; padding: 14px 16px; min-width: 0; }
.touch-value { color: var(--ink-0); font-weight: 500; }
.touch-sub { color: var(--ink-3); font-size: 11.5px; margin-top: 2px; }
.touch-card p { margin: 7px 0 0; color: var(--ink-2); font-size: 12px; }
.touch-card--overdue .touch-value { color: var(--bad); }
.touch-card--today .touch-value { color: var(--blue); }
.touch-card--soon .touch-value { color: var(--warn); }
.callout { display: flex; gap: 16px; background: linear-gradient(180deg, var(--blue-tint), #fbfcff); border: 1px solid rgba(46,93,255,.2); border-left: 4px solid var(--blue); padding: 18px 22px; border-radius: 8px; }
.callout .l { color: var(--blue); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; font-weight: 500; }
.callout .t { margin-top: 12px; color: var(--ink-0); font-size: 16px; font-weight: 600; }
.callout-follow { margin-top: 10px; color: var(--ink-2); font-size: 15px; }
.qrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 14px; }
.qpreset { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 7px 14px; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); color: var(--ink-1); font-size: 15px; line-height: 1; }
.qpreset span { color: var(--ink-3); }
.qpreset:hover { border-color: var(--ink-3); }
.qpreset--clear { color: var(--bad); }
.qpreset--date { position: relative; color: var(--blue); border-style: dashed; border-color: rgba(46,93,255,.35); }
.drawer-date-input { position: absolute; inset: 0; cursor: pointer; opacity: 0; }
.task { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--rule-soft); border-radius: 8px; background: var(--surface); margin-bottom: 10px; }
.task-check { width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--ink-3); display: inline-flex; align-items: center; justify-content: center; }
.task.is-done .task-check { background: var(--good); border-color: var(--good); color: #fff; }
.task-title { color: var(--ink-0); font-size: 16px; }
.task.is-done .task-title { color: var(--ink-3); text-decoration: line-through; }
.task-due { color: var(--ink-3); font-size: 13px; }
.task-due.overdue { color: var(--bad); font-weight: 500; }
.task-due.today { color: var(--blue); font-weight: 500; }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 8px 0; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 10px; top: 26px; bottom: -2px; width: 1px; background: var(--rule-soft); }
.tl-item:last-child::before { display: none; }
.tl-pip { width: 22px; height: 22px; border: 1px solid var(--rule); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); background: var(--surface); }
.tl-head { display: flex; align-items: baseline; gap: 8px; }
.tl-head .who { color: var(--ink-0); font-weight: 500; }
.tl-head .when { margin-left: auto; color: var(--ink-3); font-size: 11px; }
.tl-summary { margin-top: 2px; color: var(--ink-1); }
.tl-outcome { margin-top: 3px; color: var(--ink-2); font-size: 11.5px; }
.timeline-empty { color: var(--ink-3); font-size: 12.5px; padding: 6px; }
.drawer .timeline { gap: 14px; }
.drawer .tl-item {
  grid-template-columns: 38px 1fr;
  gap: 14px;
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  background: var(--surface);
  padding: 14px 16px;
}
.drawer .tl-item::before { display: none; }
.drawer .tl-pip {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: var(--paper-2);
  color: var(--ink-2);
}
.drawer .tl-head { font-size: 12px; }
.drawer .tl-head .who { font-size: 14px; }
.drawer .tl-summary { margin-top: 5px; color: var(--ink-1); font-size: 15px; line-height: 1.35; }
.drawer-empty {
  color: var(--ink-3);
  font-size: 16px;
  line-height: 1.35;
  padding: 2px 4px 14px;
}
.drawer-empty--large { padding-top: 12px; }
.drawer-section-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--ink-2);
  font-size: 15px;
}
.drawer-section-link:hover,
.section-title a:hover {
  color: var(--ink-0);
}

/* V2.1 drawer proportions: compact side panel, not the full-page lead layout. */
.drawer {
  width: 520px;
  max-width: 92vw;
  background: var(--paper);
  box-shadow: var(--shadow-side);
}
.drawer-head {
  padding: 18px 22px 14px;
  gap: 12px;
  flex: 0 0 auto;
  background: #fff;
}
.drawer-head-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.drawer-head-top .icon-btn {
  color: var(--ink-3);
}
.drawer-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.drawer-head-actions .spacer {
  flex: 1;
}
.drawer-meta-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 12px;
}
.drawer-meta-inline span,
.drawer-meta-inline a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
  text-decoration: none;
}
.drawer-meta-inline svg {
  flex: 0 0 auto;
  color: var(--ink-3);
}
.drawer-title {
  margin: 0;
  flex: 1;
  min-width: 0;
  color: var(--ink-0);
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.drawer-title input {
  width: 100%;
  border: 0;
  border-bottom: 1px dashed transparent;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  outline: 0;
}
.drawer-title input:focus {
  border-bottom-color: var(--blue);
  box-shadow: none;
}
.drawer-title-edit {
  display: block;
  width: 100%;
  min-width: 0;
  color: inherit;
  text-align: left;
  font: inherit;
  line-height: inherit;
}
.drawer-title-edit span:first-child {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-title-edit-mark {
  display: none;
}
.drawer-open-page {
  margin-top: 0;
  font-size: 13.5px;
}
.drawer-meta {
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  padding: 14px 22px 16px;
  background: #fff;
  font-size: 12.5px;
}
.drawer-meta .k {
  margin-bottom: 3px;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.drawer-meta .v {
  color: var(--ink-1);
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.drawer-meta .meta-select {
  min-width: 0;
}
.drawer-meta .meta-select-control {
  min-height: 30px;
  padding: 5px 28px 5px 9px;
  border-radius: 6px;
  background-color: #fff;
  color: var(--ink-1);
  font-size: 12.5px;
}
.drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 22px 28px;
}
.drawer-section {
  margin-top: 18px;
}
.drawer-section:first-child {
  margin-top: 14px;
}
.drawer-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.drawer-section-head .rule {
  flex: 1;
  height: 1px;
  background: var(--rule-soft);
}
.drawer-section-head a {
  color: var(--ink-2);
  font-size: 11.5px;
  letter-spacing: 0;
  text-decoration: none;
  text-transform: none;
  white-space: nowrap;
}
.drawer-section-head a:hover {
  color: var(--ink-0);
}

.stages {
  display: flex;
  align-items: flex-start;
  isolation: isolate;
  padding: 12px 4px 4px;
  position: relative;
}
.stage-node {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: center;
  cursor: pointer;
}
.stage-node + .stage-node::before {
  content: "";
  position: absolute;
  top: 8px;
  right: 50%;
  left: -50%;
  z-index: 0;
  height: 2px;
  background: var(--rule);
}
.stage-node.is-past::before,
.stage-node.is-current::before {
  background: var(--ink-0);
}
.stage-pip {
  position: relative;
  z-index: 2;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--rule);
  border-radius: 50%;
  background: #fff;
  color: var(--ink-3);
  font-size: 9.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.stage-pip-n {
  line-height: 1;
}
.stage-node.is-past .stage-pip {
  border-color: var(--ink-0);
  background: var(--ink-0);
  color: #fafafa;
}
.stage-node.is-current .stage-pip {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(46,93,255,.18);
  transform: scale(1.05);
}
.stage-node:hover:not(.is-current) .stage-pip {
  border-color: var(--ink-1);
  color: var(--ink-1);
}
.stage-node.is-past:hover .stage-pip {
  border-color: var(--blue);
  background: var(--blue);
  color: #fafafa;
}
.stage-name {
  position: relative;
  z-index: 2;
  max-width: 100%;
  padding: 0 3px;
  background: var(--surface);
  overflow: hidden;
  color: var(--ink-3);
  font-size: 10.5px;
  letter-spacing: .01em;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stage-node.is-past .stage-name {
  color: var(--ink-1);
}
.stage-node.is-current .stage-name {
  color: var(--blue);
  font-weight: 500;
}
.drawer-head .stages {
  margin-top: 4px;
}

.callout {
  gap: 10px;
  align-items: flex-start;
  border: 1px solid rgba(46,93,255,.15);
  border-left: 3px solid var(--blue);
  border-radius: 6px;
  background: linear-gradient(180deg, var(--blue-tint), #fbfcff);
  padding: 12px 14px;
}
.callout-icon {
  margin-top: 1px;
  color: var(--blue);
}
.callout-body {
  flex: 1;
  min-width: 0;
  color: var(--ink-1);
  font-size: 12.5px;
}
.callout-body .l {
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.callout-body .t {
  margin-top: 0;
  color: var(--ink-0);
  font-size: 12.5px;
  font-weight: 500;
}
.callout-follow {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 12px;
}
.qrow {
  gap: 6px;
  padding: 8px 0 0;
}
.qpreset {
  gap: 5px;
  min-height: 0;
  padding: 4px 9px;
  background: #fff;
  font-size: 11.5px;
}
.qpreset .when {
  color: var(--ink-3);
  font-size: 10.5px;
}
.qpreset--date {
  background: transparent;
}
.qpreset--clear {
  color: var(--ink-3);
}
.qpreset--clear:hover {
  color: var(--bad);
  border-color: rgba(181,58,58,.35);
}
.task {
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fff;
  margin-bottom: 6px;
}
.task-check {
  width: 16px;
  height: 16px;
  border-width: 1.5px;
  border-radius: 4px;
}
.task-title {
  font-size: 13px;
}
.task-due {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.drawer .timeline {
  gap: 0;
}
.drawer .tl-item {
  grid-template-columns: 22px 1fr;
  gap: 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 8px 0;
}
.drawer .tl-item::before {
  display: block;
}
.drawer .tl-pip {
  width: 22px;
  height: 22px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: #fff;
}
.drawer .tl-head {
  font-size: 11px;
}
.drawer .tl-head .who {
  font-size: 12.5px;
}
.drawer .tl-summary {
  margin-top: 2px;
  color: var(--ink-1);
  font-size: 12.5px;
  line-height: 1.5;
}
.drawer-empty {
  padding: 4px 2px 0;
  color: var(--ink-3);
  font-size: 12.5px;
}
.drawer-empty--large {
  padding-top: 6px;
}
.drawer-section-link {
  margin-top: 8px;
  gap: 7px;
  color: var(--ink-2);
  font-size: 11.5px;
}
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.detail-item { border: 1px solid var(--rule-soft); background: var(--surface); border-radius: 6px; padding: 10px 12px; min-width: 0; }
.detail-item span { display: block; color: var(--ink-3); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 3px; }
.detail-item strong { display: block; color: var(--ink-1); font-weight: 500; overflow-wrap: anywhere; }
.detail-item p { margin: 0; color: var(--ink-1); }
.detail-item--wide { grid-column: 1 / -1; }

.modal-back { z-index: 110; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.modal { width: 480px; max-width: 92vw; background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 24px 60px -28px rgba(10,10,10,.28); overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 14px; border-bottom: 1px solid var(--rule); }
.modal-title { flex: 1; margin: 0; color: var(--ink-0); font-family: var(--serif); font-size: 20px; }
.modal-body { background: var(--surface); padding: 16px 20px 4px; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { background: var(--surface); border-top: 1px solid var(--rule-soft); padding: 12px 20px 16px; display: flex; justify-content: flex-end; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { color: var(--ink-3); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 500; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-err { color: var(--bad); font-size: 11px; }

.cmd-back { z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding-top: 14vh; }
.cmd { width: 520px; max-width: 92vw; max-height: 70vh; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 24px 60px -28px rgba(10,10,10,.28); overflow: hidden; display: flex; flex-direction: column; }
.cmd input { border: 0; border-bottom: 1px solid var(--rule); padding: 14px 18px; outline: 0; font-size: 14.5px; }
.cmd-list { overflow-y: auto; padding: 6px; }
.cmd-section { color: var(--ink-3); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; font-weight: 500; padding: 10px 14px 4px; }
.cmd-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 6px; }
.cmd-item:hover, .cmd-item.is-active { background: var(--blue-tint); }
.cmd-item .label { flex: 1; color: var(--ink-0); }
.secondary { color: var(--ink-3); font-size: 11.5px; margin-left: 6px; }

.toaster { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; min-width: 280px; display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 8px; background: var(--ink-0); color: #fafafa; box-shadow: 0 12px 32px -8px rgba(10,10,10,.4); }
.toast .x { margin-left: auto; color: rgba(255,255,255,.58); }
.selbar { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 8px; border-radius: 999px; padding: 6px 8px 6px 14px; background: var(--ink-0); color: #fafafa; box-shadow: 0 12px 32px -8px rgba(10,10,10,.4); }
.selbar button { display: inline-flex; align-items: center; gap: 5px; color: #fafafa; background: rgba(255,255,255,.08); padding: 4px 10px; border-radius: 999px; }
.selbar button:hover { background: rgba(255,255,255,.16); }

.settings-modal {
  width: 840px;
  max-width: 94vw;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}
.settings-head {
  padding: 18px 22px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.settings-head-titles { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.settings-head-titles .kicker { color: var(--blue); }
.settings-head .modal-title { font-size: 24px; }
.settings-body {
  display: grid;
  grid-template-columns: 200px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  background: var(--paper);
}
.settings-nav {
  border-right: 1px solid var(--rule);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--paper-2);
  overflow-y: auto;
}
.settings-nav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-3);
  font-weight: 500;
  padding: 12px 10px 6px;
}
.settings-nav-section:first-child { padding-top: 0; }
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--ink-1);
  font-size: 12.5px;
  text-align: left;
  transition: background .12s, color .12s;
}
.settings-nav-item svg { color: var(--ink-3); flex: 0 0 auto; }
.settings-nav-item:hover:not(:disabled) { background: rgba(10,10,10,.04); }
.settings-nav-item:hover:not(:disabled) svg { color: var(--ink-1); }
.settings-nav-item.is-active { background: var(--ink-0); color: #fafafa; }
.settings-nav-item.is-active svg { color: rgba(250,250,250,.7); }
.settings-nav-item:disabled { color: var(--ink-3); cursor: not-allowed; }
.settings-nav-item:disabled svg { color: var(--ink-4); }
.settings-main {
  overflow-y: auto;
  padding: 22px 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: var(--surface);
}
.settings-block {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule-soft);
}
.settings-block:last-child { border-bottom: 0; padding-bottom: 0; }
.settings-block-head h3 {
  margin: 0 0 4px;
  color: var(--ink-0);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -.01em;
}
.settings-block-head p {
  margin: 0;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.5;
}
.settings-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0;
}
.settings-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-foot-note {
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
}
.settings-foot-note::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
  display: inline-block;
}
.twk-row { display: flex; flex-direction: column; gap: 5px; }
.twk-row-h { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.twk-lbl {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--ink-2);
}
.twk-lbl > span:first-child { font-weight: 500; }
.twk-val { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.twk-field {
  appearance: none;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  outline: none;
}
.twk-field:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(46,93,255,.12); }
select.twk-field {
  padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='rgba(0,0,0,.5)' d='M0 0h10L5 6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.twk-seg {
  position: relative;
  display: flex;
  padding: 2px;
  border-radius: 8px;
  background: rgba(10,10,10,.06);
  user-select: none;
}
.twk-seg-thumb {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(10,10,10,.12);
  transition: left .15s cubic-bezier(.3,.7,.4,1), width .15s;
}
.twk-seg button {
  appearance: none;
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 22px;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 500;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.twk-toggle {
  position: relative;
  width: 32px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(10,10,10,.15);
  padding: 0;
  transition: background .15s;
}
.twk-toggle[data-on="1"] { background: var(--good); }
.twk-toggle i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(10,10,10,.25);
  transition: transform .15s;
}
.twk-toggle[data-on="1"] i { transform: translateX(14px); }
.settings-controls .twk-row { gap: 7px; font-size: 12.5px; }
.settings-controls .twk-lbl { color: var(--ink-1); }
.settings-controls .twk-val { color: var(--ink-3); }
.settings-controls .twk-field { height: 32px; font-size: 12.5px; }
.settings-controls .twk-seg { background: var(--paper-2); padding: 3px; }
.settings-controls .twk-seg-thumb { top: 3px; bottom: 3px; }
.settings-controls .twk-seg button { min-height: 26px; font-size: 12.5px; }
.settings-controls .twk-toggle { width: 36px; height: 20px; }
.settings-controls .twk-toggle i { width: 16px; height: 16px; }
.settings-controls .twk-toggle[data-on="1"] i { transform: translateX(16px); }

/* Server-rendered V2 pages */
.v2-page-shell .sidebar a,
.v2-page-shell .topbar a,
.v2-page-shell .v2-page a {
  text-decoration: none;
}
.v2-server-main {
  background: var(--paper);
}
.v2-page-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.v2-page {
  width: min(1180px, calc(100vw - var(--sidebar-w) - 64px));
  margin: 0 auto;
  padding: 28px 32px 72px;
}
.v2-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.v2-page-head .board-title {
  margin-top: 2px;
}
.v2-top-search {
  margin: 0;
}
.v2-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.v2-stat-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.v2-stat-card {
  min-width: 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px 16px;
}
.v2-stat-card span {
  display: block;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.v2-stat-card strong {
  display: block;
  margin-top: 3px;
  color: var(--ink-0);
  font-family: var(--serif);
  font-size: 31px;
  font-weight: 400;
  line-height: 1;
}
.v2-stat-card small {
  display: block;
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 12px;
}
.v2-stat-card--bad strong { color: var(--bad); }
.v2-stat-card--blue strong { color: var(--blue); }
.v2-stat-card--warn strong { color: var(--warn); }
.v2-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}
.v2-report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.v2-side-stack {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 16px;
}
.v2-panel {
  min-width: 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}
.v2-panel--wide {
  min-height: 420px;
}
.v2-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--rule-soft);
}
.v2-panel-head h2 {
  margin: 0;
  color: var(--ink-0);
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 400;
  line-height: 1.1;
}
.v2-panel-head p {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 12px;
}
.v2-table-wrap {
  overflow-x: auto;
}
.v2-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}
.v2-table th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .1em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.v2-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--ink-1);
  vertical-align: middle;
  white-space: nowrap;
}
.v2-table tbody tr:hover {
  background: var(--blue-tint);
}
.v2-table tbody tr:last-child td {
  border-bottom: 0;
}
.v2-lead-link {
  display: inline-flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  color: var(--ink-0);
}
.v2-lead-link:hover strong {
  color: var(--blue);
}
.v2-lead-link strong {
  font-weight: 600;
}
.v2-lead-link span {
  max-width: 260px;
  overflow: hidden;
  color: var(--ink-3);
  font-size: 12px;
  text-overflow: ellipsis;
}
.v2-stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--rule);
  border-radius: 5px;
  background: var(--paper-2);
  color: var(--ink-2);
  padding: 3px 8px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}
.v2-stage-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: currentColor;
}
.v2-stage-pill[data-pipeline="sales"] { color: var(--blue); background: var(--blue-tint); border-color: rgba(46,93,255,.16); }
.v2-stage-pill[data-pipeline="nurture"] { color: var(--warn); background: var(--warn-soft); border-color: rgba(160,109,16,.2); }
.v2-stage-pill[data-pipeline="delivery"] { color: var(--good); background: var(--good-soft); border-color: rgba(26,143,89,.18); }
.v2-stage-pill[data-pipeline="lost"] { color: var(--bad); background: var(--bad-soft); border-color: rgba(181,58,58,.2); }
.v2-muted,
.v2-empty {
  color: var(--ink-3);
}
.v2-empty {
  margin: 0;
  padding: 16px 18px;
  font-size: 12.5px;
}
.v2-empty-cell {
  padding: 34px 14px !important;
  color: var(--ink-3) !important;
  text-align: center;
}
.v2-metric-list,
.v2-bar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 16px;
}
.v2-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.v2-metric-row strong {
  color: var(--ink-0);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.v2-bar-row {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}
.v2-bar-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-1);
  font-size: 12.5px;
}
.v2-bar-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v2-bar-meta strong {
  color: var(--ink-0);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.v2-bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-2);
}
.v2-bar-track span {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  background: var(--blue);
}
.v2-report-grid .v2-panel:nth-child(2) .v2-bar-track span { background: var(--warn); }
.v2-report-grid .v2-panel:nth-child(3) .v2-bar-track span { background: var(--good); }

.settings-v2-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}
.settings-v2-main,
.settings-v2-side,
.settings-v2-stack {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 16px;
}
.settings-v2-panel {
  overflow: hidden;
}
.settings-v2-panel + .settings-v2-panel {
  margin-top: 16px;
}
.settings-v2-stack {
  gap: 0;
  padding: 0 18px;
}
.settings-v2-row {
  min-width: 0;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.settings-v2-row:last-child {
  border-bottom: 0;
}
.settings-v2-row--split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}
.settings-v2-row h3 {
  margin: 0;
  color: var(--ink-0);
  font-size: 13.5px;
  font-weight: 600;
}
.settings-v2-row p,
.settings-v2-status-list p {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.45;
}
.settings-v2-inline-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}
.settings-v2-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px 18px;
}
.settings-v2-form label,
.settings-v2-import label,
.settings-v2-inline-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.settings-v2-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-0);
  outline: 0;
  padding: 8px 10px;
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
}
.settings-v2-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(46,93,255,.12);
}
.settings-v2-input--small {
  width: 84px;
}
.settings-v2-switch {
  position: relative;
  display: inline-flex;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
  cursor: pointer;
}
.settings-v2-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.settings-v2-switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(10,10,10,.15);
  transition: background .15s;
}
.settings-v2-switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(10,10,10,.22);
  transition: transform .15s;
}
.settings-v2-switch input:checked + span {
  background: var(--good);
}
.settings-v2-switch input:checked + span::after {
  transform: translateX(16px);
}
.settings-v2-switch input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(46,93,255,.16);
}
.settings-v2-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.settings-v2-import {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}
.settings-v2-status-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px 18px;
}
.settings-v2-log {
  max-height: 620px;
  overflow-y: auto;
  padding: 0 18px;
}
.settings-v2-log article {
  padding: 14px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.settings-v2-log article:last-child {
  border-bottom: 0;
}
.settings-v2-log-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.settings-v2-log-head strong,
.settings-v2-log-head span {
  display: block;
}
.settings-v2-log-head strong {
  color: var(--ink-0);
  font-size: 12.5px;
  font-weight: 600;
}
.settings-v2-log-head span,
.settings-v2-log-meta,
.settings-v2-log li {
  color: var(--ink-3);
  font-size: 11.5px;
}
.settings-v2-log-head em {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-2);
  padding: 2px 7px;
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.settings-v2-log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 7px;
}
.settings-v2-log ul {
  margin: 8px 0 0;
  padding-left: 16px;
}
.settings-v2-log li span {
  color: var(--ink-1);
  font-weight: 600;
}

@media (max-width: 1080px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .v2-stat-grid,
  .v2-stat-grid--four,
  .v2-report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .v2-content-grid {
    grid-template-columns: 1fr;
  }
  .settings-v2-grid {
    grid-template-columns: 1fr;
  }
  .kpi { border-bottom: 1px solid var(--rule); }
  .kpi:nth-child(n+3) { border-bottom: 0; }
  .delivered-mark, .topbar-date { display: none; }
}
@media (max-width: 820px) {
  body { overflow: auto; }
  .login-page { grid-template-columns: 1fr; }
  .login-brand {
    min-height: auto;
    gap: 28px;
    padding: 24px;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }
  .login-brand .brand-sub { display: inline; }
  .login-brand h1 { font-size: 44px; }
  .login-panel {
    min-height: auto;
    padding: 24px;
    justify-content: flex-start;
  }
  .app { min-height: 100vh; height: auto; display: flex; flex-direction: column; overflow: visible; }
  .sidebar {
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    overflow-x: auto;
  }
  .brand { flex: 0 0 auto; }
  .brand-sub, .sidebar-collapse, .nav-section, .nav-count, .sidebar-footer { display: none; }
  .nav-spacer { display: none; }
  .nav-group { flex-direction: row; gap: 4px; }
  .nav-item { width: auto; white-space: nowrap; }
  .main { height: auto; min-height: 0; }
  .topbar { min-height: 64px; height: auto; padding: 12px 16px; flex-wrap: wrap; }
  .topbar-title { min-width: 0; }
  .search { order: 3; flex: 1 0 100%; max-width: none; }
  .btn .hide-sm { display: none; }
  .v2-page {
    width: 100%;
    padding: 24px 18px 56px;
  }
  .v2-page-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .v2-stat-grid,
  .v2-stat-grid--four,
  .v2-report-grid {
    grid-template-columns: 1fr;
  }
  .settings-v2-row--split,
  .settings-v2-import {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }
  .settings-v2-inline-form {
    align-items: stretch;
    flex-wrap: wrap;
  }
  .board-head { padding: 32px 24px 20px; }
  .board { padding: 14px 24px 28px; }
  .title-row { align-items: flex-start; flex-direction: column; }
  .drawer { width: 100%; max-width: 100vw; }
  .drawer-subbar { align-items: flex-start; flex-direction: column; }
  .drawer-actions { width: 100%; justify-content: space-between; margin-left: 0; }
  .drawer-stage-rail { overflow-x: auto; padding-right: 0; padding-left: 0; }
  .drawer-stage-step { flex: 0 0 118px; }
  .drawer-meta, .field-row, .settings-body, .settings-block, .touch-grid, .detail-grid { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--rule); }
  .settings-nav-section { display: none; }
  .settings-nav-item { white-space: nowrap; }
}
@media (max-width: 640px) {
  .client-mark, .topbar-dot, .topbar-title strong, .nav-label { display: none; }
  .login-brand .client-mark,
  .login-brand .brand-sub { display: inline; }
  .login-brand h1 { font-size: 38px; }
  .topbar-client { font-size: 18px; }
  .board-title { font-size: 34px; }
  .kpi-strip { grid-template-columns: 1fr; }
  .kpi { border-right: 0; }
  .kpi:not(:last-child) { border-bottom: 1px solid var(--rule); }
  .drawer-head, .drawer-meta, .drawer-body { padding-left: 20px; padding-right: 20px; }
  .drawer-title { font-size: 26px; }
  .drawer-open-page { font-size: 13.5px; }
  .drawer-contact-line { font-size: 16px; }
  .drawer-stage-label { font-size: 16px; }
  .drawer-meta .k { font-size: 10.5px; }
  .drawer-meta .v,
  .callout .t,
  .drawer-empty,
  .task-title,
  .drawer .tl-summary { font-size: 12.5px; }
  .callout { padding: 12px 14px; }
  .qrow { align-items: stretch; flex-direction: column; }
  .qpreset { width: 100%; justify-content: center; font-size: 11.5px; }
  .task { grid-template-columns: auto 1fr; }
  .task-due { grid-column: 2; }
}

/* Lead detail V2 full-page shell */
.lead-detail-shell .sidebar a { text-decoration: none; }
.lead-detail-shell .nav-item { font-size: 13.5px; }
.detail-main { background: var(--paper); }
.detail-topbar { gap: 16px; }
.detail-back { border-right: 1px solid var(--rule); border-radius: 0; padding-right: 22px; }
.detail-crumbs {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: var(--ink-3);
  font-size: 13px;
}
.detail-crumbs strong {
  min-width: 0;
  color: var(--ink-0);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-stage-actions { flex-wrap: wrap; justify-content: flex-end; }
.detail-stage-actions form { margin: 0; }
.detail-stage-actions .btn--primary { min-width: 180px; justify-content: center; }
.detail-edit-action { flex: 0 0 auto; }
.detail-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.detail-toast {
  max-width: 1180px;
  margin: 18px auto 0;
  border: 1px solid rgba(46,93,255,.18);
  border-radius: 8px;
  background: var(--blue-tint);
  color: var(--blue);
  padding: 10px 14px;
}
.detail-page {
  width: min(1180px, calc(100vw - var(--sidebar-w) - 64px));
  margin: 0 auto;
  padding: 32px 32px 80px;
}
.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 28px;
  align-items: start;
  margin-bottom: 28px;
}
.detail-hero h1 {
  margin: 10px 0 12px;
  color: var(--ink-0);
  font-family: var(--serif);
  font-size: clamp(40px, 5vw, 52px);
  font-weight: 400;
  letter-spacing: 0;
  line-height: .96;
}
.lead-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  color: var(--ink-2);
  font-size: 13.5px;
}
.lead-meta-line a,
.property-list a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.lead-meta-line span,
.lead-meta-line a {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}
.lead-meta-line svg { color: var(--ink-3); flex: 0 0 auto; }
.detail-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.detail-status-chip,
.detail-muted-chip,
.detail-priority {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: 6px;
  border-radius: 5px;
  border: 1px solid var(--rule);
  padding: 3px 9px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}
.detail-status-chip {
  border-color: rgba(46,93,255,.18);
  background: var(--blue-soft);
  color: var(--blue);
}
.detail-status-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}
.detail-status-chip[data-status="Follow-Up"] { border-color: rgba(160,109,16,.2); background: var(--warn-soft); color: #7a5210; }
.detail-status-chip[data-status="Delayed"] { border-color: rgba(10,10,10,.08); background: var(--muted-soft); color: var(--ink-2); }
.detail-status-chip[data-status="Done"] { border-color: rgba(10,10,10,.08); background: var(--muted-soft); color: var(--ink-2); }
.detail-priority { border-color: transparent; font-weight: 600; }
.detail-priority--P1 { background: var(--ink-0); color: #fafafa; }
.detail-priority--P2 { background: var(--blue); color: #fff; }
.detail-priority--P3 { background: transparent; border-color: var(--rule); color: var(--ink-2); }
.detail-muted-chip { background: var(--surface); color: var(--ink-2); }
.followup-card {
  border: 1px solid rgba(160,109,16,.24);
  border-radius: 8px;
  background: #f6eed7;
  padding: 20px 22px;
  text-align: center;
}
.followup-main {
  margin-top: 10px;
  color: #9a650d;
  font-family: var(--serif);
  font-size: 31px;
  line-height: 1;
}
.followup-sub {
  margin-top: 8px;
  color: var(--ink-3);
  font-size: 12.5px;
}
.detail-stage-progress,
.detail-panel {
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
}
.detail-stage-progress {
  margin-bottom: 28px;
  padding: 28px 28px 26px;
}
.detail-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.detail-stage-count {
  color: var(--ink-3);
  font-size: 12px;
  white-space: nowrap;
}
.detail-stage-steps {
  display: grid;
  grid-template-columns: repeat(var(--stage-count), minmax(80px, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}
.detail-stage-step {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  color: var(--ink-3);
  text-align: center;
}
.detail-stage-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 18px;
  left: calc(50% + 19px);
  right: calc(-50% + 19px);
  height: 2px;
  background: var(--rule);
}
.detail-stage-step--visited:not(:last-child)::after { background: var(--ink-0); }
.detail-stage-node {
  position: relative;
  z-index: 1;
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-3);
  font-weight: 500;
}
.detail-stage-step--visited .detail-stage-node {
  border-color: var(--ink-0);
  background: var(--ink-0);
  color: #fafafa;
}
.detail-stage-step--current .detail-stage-node {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 0 0 7px rgba(46,93,255,.18);
}
.detail-stage-label {
  max-width: 15ch;
  color: inherit;
  font-size: 13px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.detail-stage-step--current .detail-stage-label {
  color: var(--blue);
  font-weight: 500;
}
.detail-stage-step--visited .detail-stage-label { color: var(--ink-1); }
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: start;
}
.detail-main-stack,
.detail-side-stack {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 20px;
}
.detail-panel {
  padding: 24px;
}
.panel-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.panel-title-row h2 {
  margin: 0;
  color: var(--ink-0);
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 400;
  line-height: 1.05;
}
.panel-title-row span {
  color: var(--ink-3);
  font-size: 12.5px;
}
.next-action-card {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 13px;
  border: 1px solid rgba(46,93,255,.18);
  border-left: 3px solid var(--blue);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--blue-tint), #fbfcff);
  padding: 16px 18px;
}
.next-action-card > svg { color: var(--blue); margin-top: 2px; }
.next-action-card strong {
  display: block;
  color: var(--ink-0);
  font-size: 14.5px;
  font-weight: 500;
}
.next-action-card span {
  display: block;
  margin-top: 5px;
  color: var(--ink-2);
  font-size: 13px;
}
.next-action-card b { color: var(--ink-0); }
.quick-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.quick-presets form { display: inline-flex; margin: 0; }
.custom-date-form { gap: 6px; }
.custom-date-form input {
  width: 116px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  padding: 5px 10px;
  color: var(--ink-1);
}
.note-compose {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper-2);
  padding: 16px;
}
.note-compose textarea,
.inline-edit textarea,
.inline-edit input,
.inline-edit select,
.edit-panel textarea,
.log-activity-form input,
.log-activity-form select,
.control-form select,
.edit-panel input,
.edit-panel select {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-1);
  font: inherit;
  outline: 0;
  padding: 8px 10px;
}
.note-compose textarea {
  min-height: 82px;
  border: 0;
  border-bottom: 1px dashed var(--rule);
  border-radius: 0;
  resize: vertical;
  background: transparent;
  padding: 0 0 12px;
}
.note-compose textarea:focus,
.inline-edit textarea:focus,
.inline-edit input:focus,
.inline-edit select:focus,
.edit-panel textarea:focus,
.log-activity-form input:focus,
.log-activity-form select:focus,
.control-form select:focus,
.edit-panel input:focus,
.edit-panel select:focus,
.custom-date-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(46,93,255,.1);
}
.compose-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
}
.compose-footer span {
  color: var(--ink-3);
  font-size: 11.5px;
}
.detail-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.detail-timeline [hidden] {
  display: none !important;
}
.note-row,
.activity-row {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  border: 1px solid var(--rule-soft);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}
.activity-row {
  grid-template-columns: 22px 1fr;
}
.timeline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-3);
  font-size: 12px;
}
.timeline-head strong {
  color: var(--ink-0);
  font-size: 13.5px;
  font-weight: 600;
}
.note-row p,
.activity-row p {
  margin: 5px 0 0;
  color: var(--ink-1);
}
.activity-row .activity-outcome {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--rule);
  color: var(--ink-2);
}
.activity-outcome span {
  margin-right: 7px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 10px;
  font-weight: 600;
}
.timeline-dot {
  width: 22px;
  height: 22px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
}
.inline-edit {
  margin-top: 8px;
  color: var(--ink-3);
  font-size: 12px;
}
.inline-edit summary {
  width: max-content;
  cursor: pointer;
}
.inline-edit form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.inline-edit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.activity-tabs {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper-2);
  padding: 3px;
}
.activity-tabs button {
  appearance: none;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  padding: 5px 10px;
}
.activity-tabs .is-active {
  background: var(--surface);
  color: var(--ink-0);
  box-shadow: 0 1px 2px rgba(10,10,10,.06);
}
.log-activity-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.log-activity-form select,
.log-activity-form input {
  width: auto;
  min-width: 112px;
}
.side-panel {
  padding: 22px 24px;
}
.side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.property-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
}
.property-list div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.property-list dt {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.property-list dd {
  min-width: 0;
  margin: 0;
  color: var(--ink-1);
  overflow-wrap: anywhere;
}
.mini-owner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.mini-owner .avatar {
  width: 22px;
  height: 22px;
  font-size: 10px;
}
.quick-action-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.quick-action-list form { margin: 0; }
.quick-action-list button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  border-radius: 6px;
  padding: 8px 10px;
  text-align: left;
}
.quick-action-list button:hover { background: rgba(10,10,10,.04); }
.control-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 12px;
}
.control-form label,
.edit-panel label {
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.sales-pipeline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.icon-action {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-2);
}
.icon-action:hover {
  border-color: var(--ink-3);
  color: var(--ink-0);
}
.edit-panel summary {
  cursor: pointer;
  color: var(--ink-0);
  font-family: var(--serif);
  font-size: 20px;
}
.edit-panel form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.delete-form { border-top: 1px solid var(--rule-soft); padding-top: 12px; }
.danger-link { color: var(--bad); }
.empty-state {
  margin: 0;
  color: var(--ink-3);
  font-size: 12.5px;
}

@media (max-width: 1180px) {
  .detail-page {
    width: auto;
    padding: 28px 24px 72px;
  }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-side-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 880px) {
  .detail-topbar { align-items: flex-start; }
  .detail-back { border-right: 0; padding-right: 11px; }
  .detail-crumbs { order: 3; flex-basis: 100%; }
  .detail-stage-actions { margin-left: 0; }
  .detail-stage-actions .btn--primary { min-width: 0; }
  .detail-page { padding: 24px 18px 56px; }
  .detail-hero { grid-template-columns: 1fr; }
  .followup-card { text-align: left; }
  .detail-stage-progress { overflow-x: auto; }
  .detail-stage-steps { min-width: max(620px, 100%); }
  .detail-side-stack { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .detail-hero h1 { font-size: 38px; }
  .lead-meta-line { gap: 10px; }
  .panel-title-row,
  .detail-stage-head,
  .compose-footer,
  .timeline-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .property-list div { grid-template-columns: 1fr; gap: 3px; }
  .note-compose,
  .note-row,
  .activity-row,
  .inline-edit-grid {
    grid-template-columns: 1fr;
  }
  .log-activity-form { justify-content: stretch; }
  .log-activity-form select,
  .log-activity-form input,
  .log-activity-form .btn {
    width: 100%;
  }
}
