:root {
  --ink: #0e2c34; --teal: #008489; --teal-text: #006b70; --teal-soft: #e1f2f2;
  --coral: #e5484d; --coral-soft: #fde8e8; --coral-text: #b42328;
  --amber-soft: #fff1dd; --amber-text: #8a5300; --violet-soft: #efedff; --violet-text: #5b4bb7;
  --ok-soft: #e3f6ea; --ok: #0b6b34; --grey-soft: #eef3f3;
  --mint: #f2f7f7; --line: #dce7e7; --line-2: #e8f0f0; --slate: #3b5560; --slate-2: #5a7079;
  --font: 'Fira Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--mint); font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--slate-2); }
.small { font-size: 12px; }
.late { color: var(--coral-text); }
.brand { font-size: 20px; font-weight: 600; color: var(--teal); letter-spacing: -0.01em; }
.link { border: 0; background: none; padding: 0; color: var(--teal-text); cursor: pointer; text-decoration: underline; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn--sm { min-height: 34px; padding: 0 14px; font-size: 14px; }
.btn--primary { background: var(--coral); color: #fff; }
.btn--ink { background: var(--ink); color: #fff; }
.btn--outline { background: #fff; border-color: #b9cdcd; color: var(--ink); }
.input { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.input:focus { outline: 2px solid #3fb8b4; outline-offset: 0; border-color: transparent; }
.input--sm { width: auto; min-height: 36px; }
textarea.input { resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; color: var(--slate); flex: 1 1 180px; min-width: 0; }

/* Login */
.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login__card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 32px; background: #fff; border: 1px solid var(--line); border-radius: 20px; }
.login__card h1 { margin: 4px 0 0; font-size: 26px; font-weight: 600; }
.login__card form { display: flex; flex-direction: column; gap: 14px; }
.login__done { padding: 12px 14px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); }

/* Shell */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px; padding: 22px 16px; background: #fff; border-right: 1px solid var(--line); }
.side__nav { display: flex; flex-direction: column; gap: 4px; }
.side__nav a { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 500; }
.side__nav a.active { background: var(--teal-soft); color: var(--teal-text); }
.count:not(:empty) { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--coral); color: #fff; font-size: 12px; text-align: center; }
.side__foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; font-size: 13px; overflow-wrap: anywhere; }
.main { min-width: 0; }
.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 12px; padding: 14px 28px; background: rgba(242, 247, 247, 0.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line-2); }
.top__search { max-width: 520px; }
.view { padding: 8px 28px 48px; }
.title { margin: 18px 0 18px; font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }

/* Lists */
.block { margin-bottom: 22px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.block__title { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.empty { margin: 0; }
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(0, 2fr) auto; align-items: center; gap: 16px; width: 100%; padding: 12px 8px; border: 0; border-top: 1px solid var(--line-2); background: none; text-align: left; cursor: pointer; border-radius: 8px; }
.row:first-child { border-top: 0; }
.row:hover { background: var(--mint); }
.row__main { display: flex; flex-direction: column; min-width: 0; }
.row__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__sub { font-size: 13px; color: var(--slate-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__note { font-size: 14px; color: var(--slate); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__meta { display: flex; gap: 6px; align-items: center; }
.star { color: #e3a008; margin-right: 6px; }

.status, .chip, .pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status--nuevo { background: var(--teal-soft); color: var(--teal-text); }
.status--contactado { background: var(--amber-soft); color: var(--amber-text); }
.status--demo { background: var(--violet-soft); color: var(--violet-text); }
.status--prueba { background: #e7f1fb; color: #1d5fa0; }
.status--cliente { background: var(--ok-soft); color: var(--ok); }
.status--perdido { background: var(--grey-soft); color: var(--slate-2); }
.chip { background: var(--grey-soft); color: var(--slate); font-weight: 500; }
.chip--today { background: var(--amber-soft); color: var(--amber-text); }
.chip--late { background: var(--coral-soft); color: var(--coral-text); }

/* Board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 14px; background: #e8f0f0; min-height: 200px; }
.col.drop { outline: 2px dashed var(--teal); }
.col__title { display: flex; justify-content: space-between; align-items: center; margin: 2px 4px 4px; font-size: 14px; }
.col__cards { display: flex; flex-direction: column; gap: 8px; }
.card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; cursor: grab; font-size: 14px; }
.card strong { font-weight: 600; }
.card__step { font-size: 13px; }

/* Table */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 12px 14px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--slate-2); border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr[data-id] { cursor: pointer; }
.table tr[data-id]:hover { background: var(--mint); }

/* Summary */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 22px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.kpi span { font-size: 13px; color: var(--slate-2); }
.kpi strong { font-size: 30px; font-weight: 600; }
.kpi em { font-style: normal; font-size: 13px; color: var(--slate-2); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 16px; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: 130px 1fr 36px; gap: 10px; align-items: center; font-size: 14px; }
.bar__track { height: 10px; border-radius: 999px; background: var(--grey-soft); overflow: hidden; }
.bar__fill { display: block; height: 100%; border-radius: 999px; background: var(--teal); }
.bar strong { text-align: right; }

/* Drawer */
.drawer { position: fixed; top: 0; right: 0; z-index: 20; width: min(520px, 100vw); height: 100vh; overflow-y: auto; background: #fff; border-left: 1px solid var(--line); box-shadow: -20px 0 50px -30px rgba(14, 44, 52, 0.45); }
.drawer__head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 18px 22px; background: #fff; border-bottom: 1px solid var(--line-2); }
.drawer__head h2 { flex: 1; margin: 0; font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
.icon-btn { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 18px; cursor: pointer; color: var(--slate-2); }
.icon-btn.on { color: #e3a008; border-color: #f3d27a; background: #fff8e1; }
.drawer__body { display: flex; flex-direction: column; gap: 18px; padding: 18px 22px 40px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { border: 1px solid transparent; cursor: pointer; padding: 6px 12px; font-size: 13px; opacity: 0.55; }
.pill.on { opacity: 1; border-color: currentColor; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form__row { display: flex; flex-wrap: wrap; gap: 12px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet { padding: 14px; border-radius: 14px; background: var(--mint); border: 1px solid var(--line); }
.sheet--hl { background: #fff9e0; border-color: #f3e3a1; }
.sheet h3, .notes h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.sheet pre { margin: 0 0 8px; white-space: pre-wrap; font-family: inherit; font-size: 14px; overflow-wrap: anywhere; }
.sheet__note { margin: 0 0 6px; font-weight: 600; }
.note-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.note-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.note-list li p { margin: 0 0 2px; white-space: pre-wrap; }
.history summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.history ul { list-style: none; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 30; padding: 10px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side__nav { flex-direction: row; flex-wrap: wrap; }
  .side__foot { display: none; }
  .top { padding: 12px 16px; }
  .view { padding: 8px 16px 40px; }
  .row { grid-template-columns: 1fr; gap: 4px; }
}

.tag { display: inline-flex; margin: 0 4px 4px 0; padding: 2px 8px; border-radius: 6px; background: #e8f0f0; color: var(--slate); font-size: 12px; white-space: nowrap; }
.lead-text { margin: -8px 0 16px; }
.more { margin-top: 14px; }
.form > .field { flex: none; }
.table--prospects { min-width: 1150px; }
.table--prospects td:nth-child(4) { min-width: 210px; overflow-wrap: anywhere; }
.table--prospects td:nth-child(5) { min-width: 300px; }
.table--prospects .how { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
