@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700;900&display=swap');

:root {
  --purple: #643083;
  --purple-dark: #4a2361;
  --magenta: #C81781;
  --teal: #67B38F;
  --ink: #241A30;
  --paper: #FBFAFC;
  --card: #FFFFFF;
  --line: #E7E1EE;
  --muted: #8A7D99;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Lato', sans-serif;
  background: var(--paper);
  color: var(--ink);
}

a { color: inherit; }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--purple) 0%, var(--purple-dark) 55%, #2c1740 100%);
  padding: 24px;
}

.login-card {
  background: var(--card);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 30px 60px rgba(36, 26, 48, 0.35);
}

.login-brand {
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.5px;
  color: var(--purple);
  margin-bottom: 2px;
}

.login-tagline {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink);
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  font-family: inherit;
  font-size: 14px;
  background: var(--paper);
  color: var(--ink);
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--purple);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--purple); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--purple-dark); }
.btn-ghost { background: transparent; color: var(--purple); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--purple); }
.btn-danger { background: transparent; color: var(--magenta); border: 1.5px solid var(--line); }

.login-error {
  color: var(--magenta);
  font-size: 13px;
  margin-top: 10px;
  min-height: 16px;
}

/* ---------- App shell ---------- */
.app {
  display: none;
  min-height: 100vh;
  grid-template-columns: 220px 1fr;
}
.app.visible { display: grid; }

.sidebar {
  background: linear-gradient(180deg, var(--purple) 0%, var(--purple-dark) 100%);
  color: #fff;
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  font-weight: 900;
  font-size: 19px;
  margin-bottom: 2px;
}
.sidebar-tagline {
  font-size: 11px;
  opacity: 0.7;
  margin-bottom: 32px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.75;
  margin-bottom: 4px;
}
.nav-item:hover { opacity: 1; background: rgba(255,255,255,0.08); }
.nav-item.active { opacity: 1; background: rgba(255,255,255,0.16); }

.sidebar-footer {
  margin-top: auto;
  font-size: 12px;
  opacity: 0.6;
  cursor: pointer;
}

.main {
  padding: 32px 40px;
  max-width: 1200px;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.main-title {
  font-size: 24px;
  font-weight: 900;
  margin: 0;
}
.main-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.view { display: none; }
.view.active { display: block; }

/* ---------- Stat strip ---------- */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.stat-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-box .num { font-size: 26px; font-weight: 900; color: var(--purple); }
.stat-box .lbl { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }

/* ---------- Cards / lists ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  align-items: center;
}
.toolbar input[type="text"] {
  flex: 1;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  font-family: inherit;
  font-size: 14px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.client-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
}
.client-card.status-active { border-left-color: var(--teal); }
.client-card.status-prospect { border-left-color: var(--magenta); }
.client-card.status-paused { border-left-color: #D9A441; }
.client-card.status-past { border-left-color: var(--muted); }

.client-card h3 { margin: 0 0 4px; font-size: 16px; }
.client-card .meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  background: #F1EAF7;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.status-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.status-pill.status-active { background: #E4F4EC; color: #2F7A56; }
.status-pill.status-prospect { background: #FCE6F1; color: var(--magenta); }
.status-pill.status-paused { background: #FCF1DC; color: #A87415; }
.status-pill.status-past { background: #EFECF2; color: var(--muted); }

/* ---------- Pipeline ---------- */
.pipeline-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.pipeline-col {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 200px;
}
.pipeline-col h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  margin: 0 0 10px;
}
.deal-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 13px;
  cursor: pointer;
}
.deal-card strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.deal-card .val { color: var(--teal); font-weight: 700; font-size: 12px; }

/* ---------- Tasks ---------- */
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
}
.task-row .task-title { flex: 1; font-weight: 700; font-size: 14px; }
.task-row .task-client { font-size: 12px; color: var(--muted); }
.task-status-select {
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
}

/* ---------- Modal ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(36, 26, 48, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-overlay.visible { display: flex; }
.modal {
  background: var(--card);
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
}
.modal h2 { margin-top: 0; font-size: 19px; }
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.modal-close {
  position: absolute;
  top: 18px; right: 18px;
  cursor: pointer;
  color: var(--muted);
  font-size: 20px;
  background: none;
  border: none;
}

/* ---------- Workflow ---------- */
.workflow-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
  cursor: pointer;
}
.workflow-row .wf-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.workflow-row .wf-title { font-weight: 700; font-size: 14.5px; }
.workflow-row .wf-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.wf-stages {
  display: flex;
  gap: 6px;
}
.wf-stage {
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: #EFECF2;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.wf-stage.done { background: #E4F4EC; color: #2F7A56; }
.wf-stage.current { background: #F1EAF7; color: var(--purple); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state .btn { margin-top: 14px; }

@media (max-width: 900px) {
  .app.visible { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; align-items: center; padding: 14px; }
  .sidebar-brand, .sidebar-tagline, .sidebar-footer { display: none; }
  .nav-item { white-space: nowrap; margin-bottom: 0; }
  .main { padding: 20px; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .pipeline-board { grid-template-columns: 1fr; }
}
