:root {
  --navy: #1f3a5f;
  --navy-soft: #2a4a73;
  --gold: #c8a04a;
  --bg: #eef2f6;
  --surface: #ffffff;
  --muted: #64748b;
  --line: #e2e8f0;
  --r: #dc2626;
  --a: #d97706;
  --v: #059669;
  --shadow: 0 1px 3px rgba(31, 58, 95, 0.08);
  --radius: 14px;
  --nav-w: 220px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: #0f172a;
  min-height: 100dvh;
}

.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.shell.authed { flex-direction: row; }

/* —— Login —— */
.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.login-card {
  width: min(100%, 420px);
  background: var(--surface);
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: 0 12px 40px rgba(31, 58, 95, 0.12);
}
.login-kicker {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0;
}
.login-title {
  text-align: center;
  font-size: 1.65rem;
  font-weight: 650;
  color: var(--navy);
  margin: 8px 0 0;
  line-height: 1.2;
}
.login-sub { text-align: center; font-size: 0.875rem; color: var(--muted); margin: 12px 0 0; line-height: 1.45; }
.login-meta { text-align: center; font-size: 0.8125rem; color: var(--muted); margin: 12px 0 0; }
.role-btn {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.role-btn:hover { border-color: var(--gold); box-shadow: var(--shadow); }
.role-btn b { color: var(--navy); display: block; }
.role-btn span { font-size: 12px; color: var(--muted); }
.login-card-wide { width: min(100%, 460px); max-height: min(92vh, 720px); overflow-y: auto; }
.login-group-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 18px 0 0;
  font-weight: 600;
}
.login-group-label:first-of-type { margin-top: 16px; }
.role-btn-extend { border-left: 3px solid var(--navy); }
.role-btn-woo { border-left: 3px solid #7c3aed; }
body.product-woo .nav-extend,
body.product-woo .nav-extend-only { display: none !important; }
body.product-extend .nav-woo { display: none !important; }
.sidebar-link {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  padding: 0;
  margin-top: 8px;
  font-size: 11px;
  text-decoration: underline;
}
.card-semaforo-r { border-left: 4px solid var(--r, #dc2626); }
.card-semaforo-a { border-left: 4px solid #d97706; }
.card-semaforo-g { border-left: 4px solid #059669; }
.card-semaforo-o { border-left: 4px solid #ea580c; }
.almacen-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.almacen-actions .day-btn { font-size: 12px; }
.almacen-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
  margin: 12px 0 20px;
}
@media (max-width: 960px) {
  .almacen-board { grid-template-columns: 1fr; }
}
.almacen-col {
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 10px 12px 14px;
  min-height: 120px;
}
.almacen-col-head { margin-bottom: 10px; }
.almacen-col-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
  line-height: 1.25;
}
.almacen-col-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted, #64748b);
  line-height: 1.35;
}
.almacen-col-count {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 6px;
  margin-left: 4px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  border-radius: 999px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #cbd5e1);
  vertical-align: middle;
}
.almacen-col-stack { display: flex; flex-direction: column; gap: 10px; }
.almacen-col-empty { font-size: 12px; margin: 8px 0; padding: 0; }
.almacen-history summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  list-style: none;
}
.almacen-history summary::-webkit-details-marker { display: none; }
.almacen-history-stack .card-static { opacity: 0.88; }
.almacen-exceptions { margin-top: 8px; border-color: #fdba74; }
.sae-perm { font-size: 0.8125rem; margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; line-height: 1.4; }
.sae-perm-read { background: #f1f5f9; color: var(--muted); }
.sae-perm-warn { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }
.sae-perm-write { background: #ecfdf5; color: #065f46; border: 1px solid #6ee7b7; }

/* —— Sidebar (desktop) —— */
.sidebar {
  display: none;
  width: var(--nav-w);
  background: var(--navy);
  color: #fff;
  flex-direction: column;
  padding: 20px 12px;
  position: sticky;
  top: 0;
  height: 100dvh;
}
.brand { padding: 4px 10px 20px; }
.brand small { display: block; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); }
.brand strong { font-size: 1.1rem; font-weight: 600; }
.nav-main { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  text-align: left;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.9375rem;
  cursor: pointer;
  font-weight: 500;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-item.on { background: rgba(200, 160, 74, 0.22); color: #fff; font-weight: 600; }
.sidebar-foot { padding: 10px; font-size: 12px; opacity: 0.75; border-top: 1px solid rgba(255, 255, 255, 0.12); margin-top: 8px; }

/* —— Main column —— */
.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 100dvh; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-title { font-weight: 600; color: var(--navy); font-size: 1rem; flex: 1; min-width: 0; }
.topbar-sub { font-size: 11px; color: var(--muted); display: block; font-weight: 400; }
.search-wrap { flex: 1; max-width: 360px; display: none; }
.search-wrap input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.875rem;
}
.topbar-logout {
  display: none;
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--navy);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.topbar-logout:active { background: #f1f5f9; }

.icon-btn {
  border: none;
  background: #f1f5f9;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1rem;
  position: relative;
}
.icon-btn .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--r);
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.content { flex: 1; padding: 16px; padding-bottom: 88px; max-width: 920px; width: 100%; margin: 0 auto; box-sizing: border-box; overflow-x: hidden; }
.content.inicio-wide { max-width: 1080px; }

/* —— Bottom nav (móvil) —— mismo lenguaje que sidebar —— */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--navy);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  z-index: 30;
  justify-content: space-around;
  gap: 4px;
  box-shadow: 0 -4px 20px rgba(31, 58, 95, 0.15);
}
.bottom-nav button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 6px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  border-radius: 10px;
}
.bottom-nav button:active { background: rgba(255, 255, 255, 0.08); }
.bottom-nav button.on {
  color: #fff;
  font-weight: 600;
  background: rgba(200, 160, 74, 0.22);
}

.shell.authed { flex-direction: row; }
.sidebar { order: 0; flex-shrink: 0; }
.main-col { order: 1; flex: 1; min-width: 0; }

@media (max-width: 899px) {
  .sidebar { display: none !important; }
  .bottom-nav { display: flex; }
  .topbar-logout { display: inline-flex; align-items: center; }
  #btn-search-mobile { display: inline-flex !important; align-items: center; justify-content: center; }
  #q-mobile:not(.hidden) { display: block !important; max-width: 140px; }
}
@media (min-width: 900px) {
  .sidebar { display: flex; }
  .bottom-nav { display: none; }
  .content { padding-bottom: 24px; }
  .search-wrap { display: block; }
  .topbar-title { flex: 0 0 auto; min-width: 140px; }
  #btn-search-mobile, #q-mobile { display: none !important; }
  .topbar-logout { display: none !important; }
}

/* —— Sections —— */
.section-title { font-size: 1.125rem; font-weight: 650; color: var(--navy); margin: 0 0 4px; }
.section-lead { font-size: 0.8125rem; color: var(--muted); margin: 0 0 16px; }
.block { margin-bottom: 24px; }
.block h3 { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 10px; font-weight: 600; }

.alert-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.alert-row:hover { border-color: var(--gold); }
.alert-dot { width: 10px; height: 10px; border-radius: 999px; flex-shrink: 0; }
.alert-dot.r { background: var(--r); }
.alert-dot.a { background: var(--a); }
.alert-text { flex: 1; font-size: 0.9375rem; font-weight: 500; }
.alert-count { font-size: 0.8125rem; color: var(--muted); }

.day-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.day-item:last-child { border-bottom: none; }
.day-item:hover { background: #f8fafc; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 10px; }
.day-time { font-size: 0.8125rem; font-weight: 600; color: var(--navy); min-width: 52px; }
.day-body { flex: 1; }
.day-body strong { display: block; font-size: 0.9375rem; }
.day-body span { font-size: 0.8125rem; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}
.chip.on { border-color: var(--navy); background: #e8eef5; color: var(--navy); font-weight: 600; }
.chip-clear { color: var(--muted); }

.seg { display: inline-flex; background: #e2e8f0; border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.seg button {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--muted);
}
.seg button.on { background: var(--surface); color: var(--navy); font-weight: 600; box-shadow: var(--shadow); }

.list-stack { display: flex; flex-direction: column; gap: 10px; }
.card-btn {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.card-btn:hover { border-color: var(--gold); }
.card-static {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-id { font-weight: 650; color: var(--navy); }
.card-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.card-cli { font-size: 0.9375rem; margin-top: 4px; }
.card-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; vertical-align: middle; }
.crm-tag {
  font-size: 10px;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  font-weight: 500;
}

.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.kpi b { display: block; font-size: 1.35rem; color: var(--navy); }
.kpi span { font-size: 11px; color: var(--muted); }
.kpi.imp { grid-column: 1 / -1; background: var(--navy); color: #fff; border: none; }
.kpi.imp b { color: #fff; font-size: 1.5rem; }
.kpi.imp span { color: var(--gold); text-transform: uppercase; letter-spacing: 0.06em; }

.empty { font-size: 0.875rem; color: var(--muted); padding: 16px 0; }

/* —— Sheet —— */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
@media (min-width: 600px) {
  .sheet-backdrop { align-items: center; }
}
.sheet {
  background: var(--surface);
  width: 100%;
  max-width: 480px;
  max-height: 88dvh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 20px;
}
@media (min-width: 600px) {
  .sheet { border-radius: 20px; }
}
.sheet-handle { width: 40px; height: 4px; background: #e2e8f0; border-radius: 99px; margin: 0 auto 16px; }
.sheet-k { font-size: 12px; color: var(--muted); }
.sheet-t { font-size: 1.35rem; font-weight: 650; color: var(--navy); margin: 4px 0 12px; }
.sheet-body { font-size: 0.9375rem; line-height: 1.5; }
.followup-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.followup-dismiss { width: 100%; margin-top: 4px; }
.cotiz-pipeline-actions { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }
.cotiz-pipeline-actions.compact .modal-btn { font-size: 0.8125rem; padding: 10px 12px; }
.sheet-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.sheet-actions button {
  border: none;
  background: #f1f5f9;
  padding: 12px 8px;
  border-radius: 12px;
  font-size: 0.8125rem;
  cursor: pointer;
}
.sheet-close { width: 100%; margin-top: 10px; border: none; background: transparent; color: var(--muted); padding: 12px; cursor: pointer; }

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.875rem;
  z-index: 60;
  white-space: nowrap;
}
@media (min-width: 900px) { .toast { bottom: 24px; } }

.hidden { display: none !important; }
.corte-banner { font-size: 11px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 8px 12px; margin-bottom: 16px; }

.card-signal {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-signal.r { background: #fef2f2; color: #991b1b; }
.card-signal.a { background: #fffbeb; color: #92400e; }
.card-signal.v { background: #ecfdf5; color: #065f46; }
.card-signal.n { background: #f1f5f9; color: #475569; font-weight: 500; }

.card-btn.focus-card, .card-static.focus-card {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(200, 160, 74, 0.35);
}

.quick-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.quick-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
}
.quick-stat b { display: block; font-size: 1.1rem; color: var(--navy); }
.quick-stat span { font-size: 10px; color: var(--muted); line-height: 1.2; }

.flow-block {
  border-left: 3px solid var(--gold);
  padding-left: 12px;
  margin: 14px 0;
}
.flow-block h4 { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.flow-block p { margin: 0; font-size: 0.9375rem; }

.report-link {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 0.9375rem;
  text-align: left;
}
.report-link:hover { border-color: var(--gold); }

.list-count { font-size: 12px; color: var(--muted); margin-bottom: 10px; }

/* —— Inicio (centro de trabajo) —— */
.home-greet { margin-bottom: 20px; }
.home-greet h1 { font-size: 1.35rem; font-weight: 650; color: var(--navy); margin: 0 0 4px; line-height: 1.25; }
.home-greet p { margin: 0; font-size: 0.9375rem; color: var(--muted); }
.inicio-prior {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
}
@media (min-width: 900px) {
  .inicio-prior { flex-direction: row; align-items: flex-start; }
  .inicio-prior .inicio-col { flex: 1; min-width: 0; }
}
.home-section { margin-bottom: 8px; }
.home-section > h2 {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 600;
}
.alert-card {
  width: 100%;
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.alert-card:hover { border-color: var(--gold); }
.alert-emoji { font-size: 1.1rem; line-height: 1.3; flex-shrink: 0; }
.alert-body { flex: 1; min-width: 0; }
.alert-body strong { display: block; font-size: 0.9375rem; color: var(--navy); margin-bottom: 4px; }
.alert-body p { margin: 0 0 8px; font-size: 0.8125rem; color: var(--muted); line-height: 1.4; }
.alert-cta { font-size: 0.8125rem; font-weight: 600; color: var(--navy-soft); }

.day-task {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.day-task-head { display: flex; gap: 12px; align-items: flex-start; }
.day-time-lg { font-size: 0.9375rem; font-weight: 700; color: var(--navy); min-width: 52px; }
.day-task-main { flex: 1; min-width: 0; }
.day-task-main strong { display: block; font-size: 0.9375rem; margin-bottom: 4px; }
.day-task-main span { font-size: 0.8125rem; color: var(--muted); line-height: 1.35; display: block; }
.day-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.day-btn {
  border: 1px solid var(--line);
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.8125rem;
  cursor: pointer;
  font-weight: 500;
}
.day-btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.day-pending-title { font-size: 0.8125rem; font-weight: 600; color: var(--muted); margin: 16px 0 8px; }
.day-check { display: flex; align-items: flex-start; gap: 8px; font-size: 0.875rem; margin-bottom: 8px; color: var(--navy); }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (min-width: 600px) { .summary-grid { grid-template-columns: repeat(4, 1fr); } }
.summary-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
}
.summary-tile:hover { border-color: var(--gold); }
.summary-tile b { display: block; font-size: 1.15rem; color: var(--navy); }
.summary-tile span { font-size: 11px; color: var(--muted); line-height: 1.25; }

@media (max-width: 899px) {
  .summary-panel {
    background: var(--navy);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    padding: 14px 12px 12px;
    margin-top: 4px;
    box-shadow: var(--shadow);
  }
  .summary-panel > h2 {
    color: var(--gold);
    letter-spacing: 0.08em;
  }
  .summary-panel .list-count {
    color: rgba(255, 255, 255, 0.65);
    margin-top: 10px !important;
  }
  .summary-panel .summary-tile {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
  }
  .summary-panel .summary-tile b { color: #fff; }
  .summary-panel .summary-tile span { color: rgba(255, 255, 255, 0.78); }
  .summary-panel .summary-tile.on,
  .summary-panel .summary-tile:active { background: rgba(200, 160, 74, 0.25); border-color: rgba(200, 160, 74, 0.45); }
}

.feed-list { display: flex; flex-direction: column; gap: 10px; }
.feed-item { font-size: 0.8125rem; color: var(--muted); line-height: 1.45; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: none; }
.feed-item strong { color: var(--navy); font-weight: 600; }

.sheet-schedule {
  width: 100%;
  margin-top: 12px;
  border: 1px dashed var(--gold);
  background: #fffbeb;
  color: #92400e;
  padding: 12px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}
.field-label { display: block; font-size: 11px; text-transform: uppercase; color: var(--muted); margin: 10px 0 4px; }
.field-input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 0.9375rem; box-sizing: border-box; }
.field-input:disabled { background: #f1f5f9; color: var(--muted); cursor: not-allowed; }
.clie-contact-block .field-hint { font-size: 11px; color: var(--muted); font-weight: 400; }
.clie-contact-edit-btn {
  margin-top: 8px;
  width: 100%;
}
.clie-contact-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.clie-contact-actions.hidden {
  display: none;
}
.clie-contact-block .modal-btn.secondary {
  background: #f1f5f9;
  color: var(--navy);
  border: 1px solid #e2e8f0;
}
.clie-contact-block .modal-btn { margin-top: 0; width: 100%; }
.clie-contact-block .modal-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.clie-contact-block .modal-btn.clie-save-blocked { opacity: 0.55; cursor: not-allowed; }
.clie-contact-block .modal-btn.linkish {
  margin-top: 8px;
  width: 100%;
  background: transparent;
  color: var(--navy);
  border: 1px dashed #cbd5e1;
  font-size: 13px;
}
.clie-field-dirty { outline: 2px solid rgba(217, 119, 6, 0.35); outline-offset: 0; }
.clie-contact-status {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
}
.clie-contact-status.hidden { display: none; }
.clie-contact-status-pending { background: #fffbeb; color: #92400e; }
.clie-contact-status-saving { background: #eff6ff; color: #1e40af; }
.clie-contact-status-success { background: #ecfdf5; color: #065f46; }
.clie-contact-status-dry_run { background: #f0f9ff; color: #0369a1; }
.clie-contact-status-error { background: #fef2f2; color: #991b1b; }
.clie-contact-status-conflict { background: #fef3c7; color: #92400e; }
.clie-contact-status-warn { background: #fff7ed; color: #9a3412; }
.modal-sub { font-size: 0.875rem; color: var(--muted); margin: 0 0 12px; line-height: 1.45; }
.modal-btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.diag-panel {
  font-size: 0.8125rem;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  line-height: 1.45;
}
.diag-panel p { margin: 0 0 6px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  max-width: 400px;
  width: 100%;
}
.modal h3 { margin: 0 0 8px; color: var(--navy); }
.modal p { font-size: 0.875rem; color: var(--muted); margin: 0 0 16px; line-height: 1.45; }
.modal-btn {
  width: 100%;
  border: 1px solid var(--line);
  background: #f1f5f9;
  padding: 12px;
  border-radius: 12px;
  font-size: 0.875rem;
  cursor: pointer;
  margin-bottom: 8px;
}
.modal-btn.danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.modal-btn.ghost { background: transparent; border: none; color: var(--muted); margin-bottom: 0; }

/* —— CRM visual (pipeline, ficha tabs, embudo) —— */
.badge-src {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 6px;
  vertical-align: middle;
  margin-right: 4px;
}
.badge-sae { background: var(--navy); color: #fff; }
.badge-ext { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.crm-semaforo {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}
.sem-tile {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
}
.sem-tile b { display: block; font-size: 1.5rem; }
.sem-r b { color: var(--r); }
.sem-a b { color: var(--a); }
.sem-v b { color: var(--v); }
.sem-tile span { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.crm-pipe-mini-btn {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.crm-pipe-bar {
  display: flex;
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid var(--line);
}
.crm-pipe-bar span { min-width: 2px; }
.seg-emit { background: #94a3b8; }
.seg-crm { background: var(--gold); }
.seg-ped { background: var(--navy-soft); }
.seg-win { background: var(--v); }
.seg-loss { background: #cbd5e1; }
.crm-kanban {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
}
.crm-kanban-col {
  flex: 0 0 180px;
  max-width: 200px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  scroll-snap-align: start;
}
.crm-kanban-col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.crm-kanban-count {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
}
.crm-kanban-cards .card-btn { margin-bottom: 8px; }
.crm-kanban-more { margin: 4px 0 0; font-size: 11px; }
.crm-funnel { margin-top: 12px; }
.crm-funnel-row {
  display: grid;
  grid-template-columns: 1fr minmax(80px, 2fr) 32px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
}
.crm-funnel-label { color: var(--muted); }
.crm-funnel-track {
  height: 10px;
  background: #f1f5f9;
  border-radius: 6px;
  overflow: hidden;
}
.crm-funnel-fill { display: block; height: 100%; border-radius: 6px; }
.bar-emit { background: #94a3b8; }
.bar-crm { background: var(--gold); }
.bar-ped { background: var(--navy-soft); }
.bar-win { background: var(--v); }
.sheet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.sheet-tab {
  border: 1px solid var(--line);
  background: #f1f5f9;
  color: var(--navy);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}
.sheet-tab.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.crm-timeline { border-left: 2px solid var(--line); padding-left: 12px; margin: 8px 0 12px; }
.crm-timeline-item { margin-bottom: 12px; font-size: 13px; line-height: 1.45; }
.crm-timeline-item small { color: var(--muted); display: block; margin-bottom: 2px; }
.crm-sheet-badges { font-size: 13px; margin: 8px 0; }
.linkish-inline {
  background: none;
  border: none;
  padding: 0;
  color: var(--navy);
  font: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.comercial-nav { margin-bottom: 14px; }
.ventas-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin: 12px 0 16px;
  max-width: 520px;
}
.ventas-controls .field-input { flex: 1; min-width: 100px; }
.ventas-controls .modal-btn { width: auto; margin: 0; flex: 1 1 100%; }
.venta-chart .crm-funnel-row { grid-template-columns: 1fr minmax(100px, 2fr) 72px; }
