:root {
  --nav: #061725;
  --nav2: #0b2b3a;
  --teal: #00a99d;
  --pink: #e91e63;
  --bg: #f5f8fb;
  --card: #ffffff;
  --text: #102033;
  --muted: #64748b;
  --line: #e6edf4;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #f59e0b;
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text)
}

.app {
  display: flex;
  min-height: 100vh
}

.side {
  width: 260px;
  background: linear-gradient(180deg, var(--nav), #07111d);
  color: white;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow: auto;
  transition: .25s;
  z-index: 10
}

.side.collapsed {
  width: 78px
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08)
}

.brand img {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  object-fit: cover;
  background: #102033
}

.brand h1 {
  font-size: 18px;
  line-height: 1.05;
  margin: 0
}

.brand small {
  color: #9ddbd6
}

.collapsed .brand h1,
.collapsed .nav span,
.collapsed .section {
  display: none
}

.nav {
  padding: 12px
}

.section {
  font-size: 11px;
  letter-spacing: .08em;
  color: #8fb3c3;
  margin: 18px 12px 8px;
  text-transform: uppercase
}

button.navbtn {
  width: 100%;
  border: 0;
  background: transparent;
  color: white;
  text-align: left;
  padding: 11px 12px;
  border-radius: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  font-weight: 650
}

button.navbtn:hover,
button.navbtn.active {
  background: linear-gradient(90deg, var(--pink), #ff4f88)
}

.navbtn i {
  width: 22px;
  text-align: center;
  font-style: normal
}

.main {
  margin-left: 260px;
  width: calc(100% - 260px);
  transition: .25s
}

.main.full {
  margin-left: 78px;
  width: calc(100% - 78px)
}

.top {
  height: 72px;
  background: white;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 5
}

.hamb {
  border: 0;
  background: #eef6f8;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 18px
}

.title h2 {
  margin: 0;
  font-size: 20px
}

.title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px
}

.content {
  padding: 20px;
  max-width: 1500px;
  margin: auto
}

.grid {
  display: grid;
  gap: 16px
}

.g4 {
  grid-template-columns: repeat(4, 1fr)
}

.g5 {
  grid-template-columns: repeat(5, 1fr)
}

.g3 {
  grid-template-columns: repeat(3, 1fr)
}

.g2 {
  grid-template-columns: repeat(2, 1fr)
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
  padding: 16px
}

.metric {
  min-height: 112px
}

.metric .lbl {
  color: var(--muted);
  font-size: 13px
}

.metric .num {
  font-size: 28px;
  font-weight: 850;
  margin: 8px 0
}

.metric .sub {
  font-size: 12px;
  color: var(--teal)
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px
}

.filters-compact label {
  font-size: 11px
}

.filters-compact input,
.filters-compact select {
  font-size: 12px;
  padding: 8px 10px
}

.filters-compact .btn {
  font-size: 12px;
  padding: 8px 14px
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #d8e3ea;
  border-radius: 12px;
  background: white;
  font: inherit
}

textarea {
  min-height: 82px
}

label {
  font-size: 12px;
  font-weight: 750;
  color: #405266;
  display: block;
  margin: 0 0 6px
}

.formgrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px
}

.formgrid .wide {
  grid-column: span 2
}

.formgrid .full {
  grid-column: 1/-1
}

/* ---- Add Lead form: smaller, sectioned layout ---- */
#addlead .formgrid {
  gap: 10px
}

#addlead .formgrid input,
#addlead .formgrid select,
#addlead .formgrid textarea {
  padding: 7px 9px;
  font-size: 12px
}

#addlead .formgrid label {
  font-size: 10.5px;
  margin-bottom: 4px
}

.formsection {
  margin-top: 16px
}

.formsection:first-of-type {
  margin-top: 0
}

.formsection-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--nav);
  padding-bottom: 6px;
  margin-bottom: 10px;
  border-bottom: 2px solid var(--line);
  cursor: pointer;
  user-select: none
}

.formsection-title .chev {
  color: var(--muted);
  font-size: 10px;
  transition: transform .15s
}

.formsection.collapsed .chev {
  transform: rotate(-90deg)
}

.formsection.collapsed .formsection-body {
  display: none
}

.formsection.status-section .formsection-body {
  background: #f0faf9;
  border: 1px solid #cdeeea;
  border-radius: 12px;
  padding: 12px 14px
}

#status {
  font-size: 13.5px;
  font-weight: 750;
  color: var(--nav)
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 15px;
  font-weight: 800;
  cursor: pointer
}

.primary {
  background: linear-gradient(90deg, var(--teal), #00d4c5);
  color: #052228
}

.danger {
  background: #fee2e2;
  color: #991b1b
}

.dark {
  background: #0b1d2a;
  color: white
}

.light {
  background: #eef6f8;
  color: #123
}

.scorebox {
  background: linear-gradient(135deg, #071725, #0f3442);
  color: white;
  border-radius: 18px;
  padding: 18px
}

.score {
  font-size: 48px;
  font-weight: 900
}

.badge {
  display: inline-block;
  border-radius: 99px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  background: #eef6f8;
  color: #14515a
}

.hot {
  background: #fee2e2;
  color: #b91c1c
}

.warm {
  background: #fff7ed;
  color: #c2410c
}

.cold {
  background: #e0f2fe;
  color: #0369a1
}

.win {
  background: #dcfce7;
  color: #166534
}

.surgeryready {
  background: #ede9fe;
  color: #6d28d9
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px
}

th,
td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top
}

th {
  font-size: 12px;
  color: #53677d;
  background: #f8fafc;
  position: sticky;
  top: 0
}

.tablewrap {
  overflow: auto;
  max-height: 520px
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap
}

.actions .btn {
  padding: 7px 9px;
  font-size: 12px
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px
}

/* Pipeline board: 3-column grid, each column scrolls its own cards */
#pipelineBoard {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  height: auto;
  overflow: visible;
}

#pipelineBoard .stage {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pipe-col-cards {
  overflow-y: auto;
  margin-top: 8px;
  padding-right: 2px;
  scrollbar-width: thin;
  max-height: 280px;
}

.stage {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: linear-gradient(180deg, #fff, #f8fbfd)
}

.stage h4 {
  margin: 0 0 6px;
  font-size: 13px
}

.stage b {
  font-size: 24px
}

.chart {
  height: 260px;
  width: 100%
}

/* ── Pipeline status icon buttons (change-status icons inside cards) ── */
.status-icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, background .15s;
}

.status-icon-btn:hover {
  transform: scale(1.2);
  background: var(--teal);
}

.status-icon-btn::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #102033;
  color: #fff;
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}

.status-icon-btn:hover::after {
  opacity: 1;
}

/* ── Pipeline column header icon chips ── */
.pl-stage-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-bottom: 4px;
}

/* ── Clickable pipeline patient card ── */
.pl-card-clickable {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-left-color 0.15s;
  border-left: 3px solid transparent;
}

.pl-card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 169, 157, 0.15);
  border-left-color: var(--teal);
}

/* ── Lead List action icon buttons ── */
.action-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
}

.action-icon-btn:hover {
  background: var(--teal);
  color: #fff;
  transform: scale(1.1);
}

.action-icon-btn.danger:hover {
  background: var(--red);
  color: #fff;
}

.action-icon-btn.disabled {
  opacity: 0.45;
  cursor: default;
}

.action-icon-btn.disabled:hover {
  background: var(--card);
  color: inherit;
  transform: none;
}

.action-icon-btn::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  background: #102033;
  color: #fff;
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}

.action-icon-btn:hover::after {
  opacity: 1;
}

.hidden {
  display: none !important
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #071725;
  color: white;
  padding: 13px 16px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  z-index: 99;
  display: none
}

@media(max-width:1000px) {
  .side {
    transform: translateX(-100%);
    width: 260px
  }

  .side.open {
    transform: translateX(0)
  }

  .side.collapsed {
    width: 260px
  }

  .main,
  .main.full {
    margin-left: 0;
    width: 100%
  }

  .g5,
  .g4,
  .g3,
  .g2 {
    grid-template-columns: 1fr
  }

  .formgrid {
    grid-template-columns: 1fr
  }

  .formgrid .wide {
    grid-column: auto
  }

  .pipeline {
    grid-template-columns: repeat(2, 1fr)
  }

  .top {
    padding: 0 12px
  }

  .content {
    padding: 12px
  }
}

.quickadd {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px
}

.scorebox.hotlead {
  background: radial-gradient(circle at 30% 20%, #ff4f88 0, #e91e63 25%, #071725 75%);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, .18), 0 20px 45px rgba(233, 30, 99, .28);
  animation: pulseHot 1.4s infinite
}

.scorebox.hotlead .score {
  font-size: 60px;
  text-shadow: 0 0 18px rgba(255, 255, 255, .55)
}

.hotmsg {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .14);
  font-weight: 900
}

.subtle {
  font-size: 12px;
  color: var(--muted)
}

.scoreTimeline {
  margin-top: 16px;
  background: linear-gradient(135deg, #071725, #0f3442);
  color: white;
  border-radius: 18px;
  padding: 18px
}

.scoreRow {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap
}

.scoreBar {
  height: 14px;
  background: rgba(255, 255, 255, .18);
  border-radius: 99px;
  overflow: hidden;
  flex: 1;
  min-width: 220px
}

.scoreFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #60a5fa, #00d4c5, #ff4f88);
  transition: .25s
}

.scoreTimeline.hotlead {
  background: radial-gradient(circle at 18% 20%, #ff4f88 0, #e91e63 18%, #071725 78%);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, .18), 0 20px 45px rgba(233, 30, 99, .28);
  animation: pulseHot 1.4s infinite
}

.scoreTimeline.hotlead .score {
  text-shadow: 0 0 18px rgba(255, 255, 255, .55)
}

.inlineActions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap
}

.inlineActions .btn {
  padding: 7px 10px;
  font-size: 12px
}

@keyframes pulseHot {
  0% {
    transform: scale(1)
  }

  50% {
    transform: scale(1.01)
  }

  100% {
    transform: scale(1)
  }
}

/* Timeline modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center
}

.modal {
  background: white;
  border-radius: 20px;
  padding: 24px;
  width: 620px;
  max-width: 95vw;
  max-height: 85vh;
  overflow: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3)
}

.modal h3 {
  margin: 0 0 16px
}

.modal.modal-sm {
  width: 380px;
  padding: 22px 24px
}

.modal-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #e6f7f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0
}

.timeline-item {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line)
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal);
  margin-top: 4px;
  flex-shrink: 0
}

.timeline-dot.status {
  background: var(--pink)
}

.timeline-content {
  flex: 1
}

.timeline-content .ti-action {
  font-weight: 700;
  font-size: 13px
}

.timeline-content .ti-notes {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px
}

.timeline-content .ti-meta {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px
}

/* Other-field toggle */
.other-field {
  display: none;
  margin-top: 6px
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

/* API status indicator */
#apiStatus {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 99px
}

.api-ok {
  background: #dcfce7;
  color: #166534
}

.api-err {
  background: #fee2e2;
  color: #991b1b
}

.api-loading {
  background: #f0f9ff;
  color: #0369a1
}

/* ── Login Screen ── */
#loginView {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background-image: url('../img/Login.png');
  background-size: cover;
  background-position: right center;
  background-color: #97dcea;
  /* matches the image's light-cyan backdrop */
}

/* Large white curved overlay — covers left ~55% with an elliptical curve on the right */
.login-panel {
  position: absolute;
  top: -5%;
  left: -2%;
  width: 62%;
  height: 110%;
  background: rgba(255, 255, 255, .97);
  clip-path: ellipse(75% 100% at 10% 50%);
  z-index: 1;
}

/* Teal accent stripe following the curve */
.login-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  clip-path: ellipse(77% 100% at 10% 50%);
  box-shadow: 4px 0 0 0 rgba(0, 169, 157, .35), 8px 0 12px 0 rgba(0, 169, 157, .12);
}

/* Content area positioned over the white panel */
.login-content {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 52%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 64px;
  z-index: 2;
}

.lc-title-vr {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .3em;
  color: var(--teal);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.lc-title-growth {
  font-size: 68px;
  font-weight: 900;
  color: var(--nav);
  line-height: 1;
  margin-bottom: 38px;
}

.lc-toggle {
  display: flex;
  background: #eef3f7;
  border-radius: 30px;
  padding: 4px;
  margin-bottom: 22px;
  width: fit-content;
}

.lc-toggle button {
  border: none;
  background: transparent;
  padding: 8px 22px;
  border-radius: 22px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
  transition: .15s;
}

.lc-toggle button.lc-active {
  background: white;
  color: var(--nav);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}

.lc-field {
  margin-bottom: 14px;
}

.lc-field input {
  width: 100%;
  padding: 16px 24px;
  border: 2px solid #dde8f0;
  border-radius: 50px;
  font-size: 15px;
  font-family: inherit;
  background: white;
  outline: none;
  box-sizing: border-box;
  transition: border-color .2s;
}

.lc-field input:focus {
  border-color: var(--teal);
}

.lc-forgot {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0 20px;
}

.lc-forgot a {
  color: var(--teal);
  text-decoration: none;
}

.lc-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 50px;
  background: var(--teal);
  color: white;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: .04em;
  transition: opacity .2s, transform .1s;
}

.lc-btn:hover {
  opacity: .88
}

.lc-btn:active {
  transform: scale(.98)
}

.lc-btn:disabled {
  opacity: .55;
  cursor: default
}

#loginError {
  font-size: 13px;
  color: var(--red);
  margin-bottom: 12px;
  display: none;
  text-align: center;
}

.lc-eye {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
}

@media (max-width: 680px) {
  .login-panel {
    clip-path: none;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    border-radius: 0;
  }

  .login-content {
    width: 100%;
    padding: 0 32px;
  }

  .lc-title-growth {
    font-size: 48px;
  }
}

.hidden {
  display: none !important;
}
