:root {
  --bg:          #f1f5f9;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --text:        #0f172a;
  --text-muted:  #64748b;
  --primary:     #1e40af;
  --primary-lt:  #dbeafe;
  --won:         #15803d;
  --won-lt:      #dcfce7;
  --lost:        #b91c1c;
  --lost-lt:     #fee2e2;
  --open-lt:     #dbeafe;
  --radius:      8px;
  --shadow:      0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --nav-h:       52px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── nav ───────────────────────────────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--primary);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.topnav-brand {
  font-size: 1.1rem; font-weight: 700; color: #fff;
  letter-spacing: .02em;
}
.topnav-brand:hover { text-decoration: none; }
.topnav-subtitle { font-size: .85rem; color: #bfdbfe; }

main { padding: 20px; }

/* ── filter bar ────────────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.filter-bar label { font-size: .85rem; color: var(--text-muted); font-weight: 500; }
.filter-bar select {
  padding: 6px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
  font-size: .875rem; cursor: pointer;
}
.filter-bar select:focus { outline: 2px solid var(--primary); }

/* ── board ─────────────────────────────────────────────────────── */
.board {
  display: flex; gap: 12px;
  overflow-x: auto; align-items: flex-start;
  padding-bottom: 20px;
}
.board::-webkit-scrollbar { height: 8px; }
.board::-webkit-scrollbar-track { background: var(--border); border-radius: 4px; }
.board::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 4px; }

/* ── column ────────────────────────────────────────────────────── */
.col {
  flex: 0 0 260px;
  background: #e8edf4;
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  max-height: calc(100vh - var(--nav-h) - 100px);
}
.col-header {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #e8edf4;
  border-radius: var(--radius) var(--radius) 0 0;
}
.col-name { font-size: .8rem; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .04em; }
.col-meta { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.col-cards {
  padding: 8px;
  overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 60px;
}
.col-cards::-webkit-scrollbar { width: 4px; }
.col-cards::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 2px; }

/* ── drag placeholder ──────────────────────────────────────────── */
.sortable-ghost { opacity: .4; }
.sortable-drag  { box-shadow: 0 8px 24px rgba(0,0,0,.2); }

/* ── deal card ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow);
  cursor: grab;
  transition: box-shadow .15s;
  border-left: 3px solid transparent;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.card-title { font-size: .9rem; font-weight: 600; line-height: 1.3; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--primary); text-decoration: none; }
.card-practice { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.card-practice a { color: var(--text-muted); }
.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px;
}
.card-value { font-size: .8rem; font-weight: 600; color: var(--text); }
.card-right { display: flex; align-items: center; gap: 6px; }
.card-date { font-size: .72rem; color: var(--text-muted); }
.avatar {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

/* status border colors */
.card[data-status="Won"]  { border-left-color: var(--won); }
.card[data-status="Lost"] { border-left-color: var(--lost); }

/* ── status badge ──────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: .72rem; font-weight: 600;
}
.badge-open { background: var(--open-lt); color: var(--primary); }
.badge-won  { background: var(--won-lt);  color: var(--won); }
.badge-lost { background: var(--lost-lt); color: var(--lost); }

/* ── detail pages ──────────────────────────────────────────────── */
.detail-wrap { max-width: 960px; margin: 0 auto; }
.breadcrumb { font-size: .8rem; color: var(--text-muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--text-muted); }

.detail-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 8px; }
.detail-title { font-size: 1.5rem; font-weight: 700; }
.detail-badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.section { background: var(--surface); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.section-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 14px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }

.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.field-item label { display: block; font-size: .72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.field-item span { font-size: .9rem; }

/* doctor / practice cards inside detail */
.linked-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; gap: 10px; align-items: flex-start;
}
.linked-card + .linked-card { margin-top: 10px; }
.linked-card-info { flex: 1; }
.linked-card-name { font-weight: 600; font-size: .95rem; }
.linked-card-sub  { font-size: .82rem; color: var(--text-muted); margin-top: 2px; }
.role-badge { font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: #f1f5f9; color: var(--text-muted); }
.role-primary { background: var(--primary-lt); color: var(--primary); }

/* ── deals table ───────────────────────────────────────────────── */
.deals-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.deals-table th { text-align: left; padding: 8px 10px; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); border-bottom: 2px solid var(--border); }
.deals-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.deals-table tr:last-child td { border-bottom: none; }
.deals-table tr:hover td { background: #f8fafc; }
