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

:root {
  --bg: #ffffff;
  --bg2: #f4f6f9;
  --border: #e2e6ed;
  --border2: #ccd2db;
  --ink: #0d1b2e;
  --ink2: #3a4a5c;
  --muted: #7a8899;
  --navy: #1a2d5a;
  --navy2: #243d78;
  --navy3: #142348;
  --blue: #3b6cc7;
  --blue-light: #e8eef8;
  --green: #1a7a4c;
  --green-light: #e6f4ec;
  --red: #b0402f;
  --red-light: #fdf1ee;
  --font: 'Inter', system-ui, sans-serif;
  --r: 8px;
  --r2: 12px;
  --shadow: 0 1px 3px rgba(26,45,90,.08), 0 4px 16px rgba(26,45,90,.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg2);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.app-shell { display: flex; min-height: 100vh; }
.main-wrap { flex: 1; min-width: 0; }
main { padding: 2.5rem 3rem; max-width: 1040px; margin: 0 auto; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--navy3);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1.5rem 1.4rem 1.2rem;
}
.sidebar-brand-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--blue);
  color: #fff; font-weight: 700; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-brand-name { font-weight: 700; font-size: .95rem; letter-spacing: -.01em; }

.sidebar-nav { flex: 1; padding: .5rem .8rem; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem .7rem;
  border-radius: var(--r);
  color: rgba(255,255,255,.62);
  text-decoration: none;
  font-size: .86rem;
  font-weight: 500;
  margin-bottom: .15rem;
  transition: background .15s, color .15s;
}
.sidebar-nav a svg { flex-shrink: 0; opacity: .85; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-footer {
  padding: 1rem 1.4rem 1.3rem;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .78rem;
}
.sidebar-user { color: rgba(255,255,255,.85); margin-bottom: .3rem; word-break: break-all; }
.sidebar-footer a { color: rgba(255,255,255,.5); text-decoration: none; }
.sidebar-footer a:hover { color: #fff; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--muted);
  text-decoration: none;
  font-size: .84rem;
  font-weight: 600;
  margin-bottom: 1.2rem;
}
.back-link:hover { color: var(--navy); }

h1 { font-size: 1.6rem; font-weight: 700; margin: 0 0 .3rem; letter-spacing: -.01em; }
p.subtitle { color: var(--muted); margin: 0 0 1.6rem; font-size: .9rem; }

.top-row { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1.6rem; gap: 1rem; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1.8rem; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--r2); padding: 1rem; }
.stat .num { font-size: 1.4rem; font-weight: 700; color: var(--navy); }
.stat .label { font-size: .74rem; color: var(--muted); margin-top: .15rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--navy);
  color: #fff !important;
  border: none;
  padding: .65rem 1.2rem;
  border-radius: var(--r);
  font-weight: 600;
  font-size: .85rem;
  text-decoration: none;
  cursor: pointer;
  font-family: var(--font);
}
.btn:hover { background: var(--navy2); }
.btn-secondary { background: #fff; color: var(--navy) !important; border: 1.5px solid var(--border2); }
.btn-secondary:hover { background: var(--bg2); }
.btn-danger { background: #fff; color: var(--red) !important; border: 1.5px solid #e6c4bc; }
.btn-danger:hover { background: var(--red-light); }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--r2); overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: .85rem 1rem; border-bottom: 1px solid var(--border); font-size: .88rem; }
th { background: var(--bg2); color: var(--muted); font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

.badge { display: inline-block; padding: .2rem .6rem; border-radius: 20px; font-size: .72rem; font-weight: 600; }
.badge-prospect, .badge-active { background: var(--blue-light); color: var(--blue); }
.badge-proposal_sent, .badge-paused { background: #fff3e0; color: #b7791f; }
.badge-questionnaire_done { background: #f0e8ff; color: #7c3aed; }
.badge-client, .badge-done { background: var(--green-light); color: var(--green); }

.actions { display: flex; gap: .9rem; align-items: center; }
.actions a { font-size: .82rem; color: var(--navy); text-decoration: none; font-weight: 600; }
.actions a:hover { text-decoration: underline; }
.actions form { display: inline; }
.actions .link-danger { background: none; border: none; color: var(--red); font-weight: 600; font-size: .82rem; cursor: pointer; padding: 0; font-family: inherit; }
.actions .link-danger:hover { text-decoration: underline; }

.empty { text-align: center; padding: 3rem; color: var(--muted); background: #fff; border-radius: var(--r2); }
.empty-inline { color: var(--muted); font-size: .88rem; }

.form-card { background: #fff; border: 1px solid var(--border); border-radius: var(--r2); padding: 2rem; max-width: 560px; box-shadow: var(--shadow); }
label { display: block; margin: 1.2rem 0 .4rem; font-weight: 600; font-size: .88rem; }
label:first-of-type { margin-top: 0; }
input, textarea, select {
  width: 100%;
  padding: .7rem;
  border-radius: var(--r);
  border: 1.5px solid var(--border2);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: .92rem;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--navy); }
.form-actions { margin-top: 1.6rem; display: flex; gap: .8rem; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg2); }
.login-card { background: #fff; border: 1px solid var(--border); border-radius: var(--r2); padding: 2.5rem; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.login-card h1 { text-align: center; margin-bottom: .3rem; }
.login-card p.subtitle { text-align: center; }
.error { background: var(--red-light); color: var(--red); padding: .7rem 1rem; border-radius: var(--r); font-size: .85rem; margin-bottom: 1rem; }

.info-card { background: #fff; border: 1px solid var(--border); border-radius: var(--r2); padding: 1.2rem; margin-bottom: 1.6rem; box-shadow: var(--shadow); }

.section { margin-bottom: 2.4rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .9rem; }
.section h2 { font-size: 1.05rem; font-weight: 700; margin: 0; color: var(--ink); }

.whatsapp-box { background: #fff; border: 1px solid var(--border); border-radius: var(--r2); padding: 1.2rem; box-shadow: var(--shadow); }
.whatsapp-box pre { white-space: pre-wrap; font-family: var(--font); font-size: .88rem; color: var(--ink2); margin: 0 0 1rem; line-height: 1.6; }

.inline-form { display: flex; gap: .6rem; margin-bottom: 1rem; }
.inline-form input { flex: 1; }
.inline-form-grid { display: grid; grid-template-columns: 2fr 1.2fr 1.5fr auto; gap: .6rem; margin-bottom: 1rem; }

.task-list { list-style: none; margin: 0; padding: 0; }
.task-row {
  display: flex;
  align-items: center;
  gap: .8rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: .55rem .6rem .55rem 1rem;
  margin-bottom: .5rem;
  transition: box-shadow .15s;
}
.task-row:hover { box-shadow: var(--shadow); }
.task-row.is-done { background: #fbfcfd; }
.task-title { flex: 1; font-size: .89rem; color: var(--ink); }
.task-row.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.task-source {
  font-size: .7rem; font-weight: 600; padding: .18rem .55rem; border-radius: 20px;
  background: var(--blue-light); color: var(--blue); text-decoration: none; white-space: nowrap;
}
.task-source.is-project { background: #f0e8ff; color: #7c3aed; }

.icon-btn {
  width: 30px; height: 30px; border-radius: var(--r);
  border: none; background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--muted); flex-shrink: 0;
  transition: background .15s, color .15s;
  padding: 0;
}
.icon-btn:hover { background: var(--bg2); color: var(--ink); }
.check-btn.is-done { background: var(--green-light); color: var(--green); }
.check-btn.is-done:hover { background: var(--green-light); color: var(--green); }
.delete-btn:hover { background: var(--red-light); color: var(--red); }

code {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1rem .4rem;
  font-size: .85em;
}

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; }
  .sidebar-nav { display: flex; padding: .4rem; }
  .sidebar-footer { display: none; }
  main { padding: 1.5rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}